Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
HeaderTemplate style formatting
posted

I have a WebDropDown in which I'm using some internal formatting to implement multiple columns. Using this implementation, I can style each line using some C# after the databind is complete. However, I'm not certain how I can apply a style to the HeaderTemplate or to the header itself after the databind. When I apply the CSS to the individual spans within, the headers look very disjointed and ugly. I would like to apply the header directly to the DIV that is generated by the HeaderTemplate itself.

ASPX

<igdd:WebDropDown ID="cbRolePermissionAddList" runat="server"
TextField="PermissionName" ValueField="PermissionID" EnableDropDownAsChild="false"
OnDataBound="cbRolePermissionAddList_DataBound" DropDownContainerWidth="500px">
<HeaderTemplate> <--- CAN I APPLY A CSS HERE IN ANY WAY?
<span class="GridHeaderStyle" style="width: 265px;">Name</span>
<span class="GridHeaderStyle" style="width: 200px;">Type</span>
</HeaderTemplate>
<ItemTemplate>
<span style="width: 265px;"><%# DataBinder.Eval(Container.DataItem, "PermissionName") %></span>
<span style="width: 200px;"><%# DataBinder.Eval(Container.DataItem, "PermissionType") %></span>
</ItemTemplate>

</igdd:WebDropDown>

C#
protected void cbRolePermissionAddList_DataBound(object sender, EventArgs e)
{

// Color the rows accordingly
bool Alternate = false;

foreach (DropDownItem ddi in ((WebDropDown) sender).Items)
{
if (Alternate)
{
ddi.CssClass = "GridItemStyle";
ddi.SelectedCssClass = "GridSelectedItemStyle";
ddi.HoverCssClass = "item2Hover";
}
else
{
ddi.CssClass = "GridAlternateItemStyle";
ddi.SelectedCssClass = "GridSelectedItemStyle";
ddi.HoverCssClass = "item1Hover";
}
Alternate = !Alternate;
}
}