Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Datagrid Header Styles


Message #1 by "Montgomery, Aiden" <Aiden.Montgomery@f...> on Wed, 23 Jan 2002 14:21:41 -0000
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C1A419.471B3E70
Content-Type: text/plain;
	charset="iso-8859-1"

Hello,
 
I am having a problem with the style of the sorting links at the top of a DataGrid.
The problem is that I have to set the Class of the header as TopRow.  I am unable to find any way of setting the color for links,
specifically, within the row style.
It is possible to set the color of the text but that is overidden by the style for the <a> tag that is put in when the
LinkButton is created.
Does anyone know of a way to access the actual LinkButton that is produced as the Sorting 'button' at the top.  I thought of a way
using Controls but if there is a simpler, and less resource hogging way of doing it, can someone please let me know.  Or at least
point me in the right direction.
 
<asp:datagrid id="myDataGrid" OnSortCommand="OnSortChange" AllowSorting="true" Border="0" CellPadding="0" width="100%"
AutoGenerateColumns="false" EnableViewState="false" runat="server">
    <HeaderStyle Height="22" CssClass="TopRow">
    </HeaderStyle>
    <ItemStyle Height="22" CssClass="TableRow">
    </ItemStyle>
    <AlternatingItemStyle CssClass="TableRowAlt">
    </AlternatingItemStyle>
    <Columns>
        <asp:TemplateColumn>
            <ItemTemplate>
                <asp:HyperLink id="editLink" Text="<%# sEditText %>" ImageUrl="~/images/edit.gif" NavigateUrl='<%#
"~/DesktopModules/EditDocs.aspx?ItemID=" + DataBinder.Eval(Container.DataItem,"getItemID")  + "&mid=" + ModuleId %>'
Visible="<%# IsEditable %>" runat="server" />
            </ItemTemplate>
        </asp:TemplateColumn>
        <asp:TemplateColumn SortExpression="getTitle">
            <ItemTemplate>
                <asp:HyperLink id="docLink" Text='<%# DataBinder.Eval(Container.DataItem,"getTitle") %>'
NavigateUrl='<%# GetBrowsePath((DataBinder.Eval(Container.DataItem,"getFileNameUrl")).ToString(),
DataBinder.Eval(Container.DataItem,"getContentSize"), (DataBinder.Eval(Container.DataItem,"getItemId")).ToString()) %>'
Target="_blank" runat="server" />
            </ItemTemplate>
        </asp:TemplateColumn>
        <asp:BoundColumn SortExpression="getOwner" DataField="getOwner" />
        <asp:BoundColumn SortExpression="getCategory" DataField="getCategory" />
        <asp:BoundColumn SortExpression="getLastUpdated" DataField="getLastUpdated" />
    </Columns>
</asp:datagrid>
 
Thank you in advance,
 
Aiden Montgomery


  Return to Index