I am using a Telerik RadGrid with ASP.Net 4.0 and Visual Studio 2010.
I am trying to tweak the CssClass for an ItemStyle based on a database field that has a status code. I want to use R_STATUS_X to set the item to use the CSS style "status_N" where N is the value in R_STATUS_X . I tried "<ItemStyle CssClass='Status_<%# DataBinder.Eval("R_STATUS_1") %>'></ItemStyle>" but it did not evaluate "R_STATUS_1" and instead replaced it with
<td class=".Status_<%# DataBinder.Eval("R_STATUS_X") %>" align="right" style="white-space:nowrap;">
Hmm, It looks like if I edit the ASPX page while debugging, this works, but if I recompile, it does not. Is there something that the component is doing at compile time to stop this and if so, is there a way to force it to work?
I am trying:
<telerik:RadGrid ID="RadGrid2" runat="server" width="99%" AllowPaging="True"
AllowSorting="True" GridLines="None" ShowStatusBar="True"
AutoGenerateColumns="False" OnItemDataBound="RadGrid1_ItemDataBound"
OnNeedDataSource="RadGrid2_NeedDataSource"
AllowCustomPaging="True" EnableLinqExpressions="False" Skin="WebBlue"
HorizontalAlign="Center">
<ClientSettings AllowColumnsReorder="True">
<Scrolling AllowScroll="True" UseStaticHeaders="False" />
</ClientSettings>
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to Pdf" ShowExportToPdfButton="True">
</CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
I am trying to tweak the CssClass for an ItemStyle based on a database field that has a status code. I want to use R_STATUS_X to set the item to use the CSS style "status_N" where N is the value in R_STATUS_X . I tried "<ItemStyle CssClass='Status_<%# DataBinder.Eval("R_STATUS_1") %>'></ItemStyle>" but it did not evaluate "R_STATUS_1" and instead replaced it with
<td class=".Status_<%# DataBinder.Eval("R_STATUS_X") %>" align="right" style="white-space:nowrap;">
Hmm, It looks like if I edit the ASPX page while debugging, this works, but if I recompile, it does not. Is there something that the component is doing at compile time to stop this and if so, is there a way to force it to work?
I am trying:
<telerik:RadGrid ID="RadGrid2" runat="server" width="99%" AllowPaging="True"
AllowSorting="True" GridLines="None" ShowStatusBar="True"
AutoGenerateColumns="False" OnItemDataBound="RadGrid1_ItemDataBound"
OnNeedDataSource="RadGrid2_NeedDataSource"
AllowCustomPaging="True" EnableLinqExpressions="False" Skin="WebBlue"
HorizontalAlign="Center">
<ClientSettings AllowColumnsReorder="True">
<Scrolling AllowScroll="True" UseStaticHeaders="False" />
</ClientSettings>
<MasterTableView>
<CommandItemSettings ExportToPdfText="Export to Pdf" ShowExportToPdfButton="True">
</CommandItemSettings>
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="R_VAL_1" HeaderText="R_VAL_1" EmptyDataText="-" >
<HeaderStyle CssClass="headerstyle"></HeaderStyle>
<ItemStyle HorizontalAlign="Right" Wrap="False" BorderWidth="5px"
CssClass='SomeGeneralCss Status_<%# DataBinder.Eval("R_STATUS_1") %>'></ItemStyle>
</telerik:GridBoundColumn>
<HeaderStyle CssClass="headerstyle"></HeaderStyle>
<ItemStyle HorizontalAlign="Right" Wrap="False" BorderWidth="5px"
CssClass='SomeGeneralCss Status_<%# DataBinder.Eval("R_STATUS_1") %>'></ItemStyle>
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" />
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
<PagerStyle Mode="NextPrevNumericAndAdvanced" Position="TopAndBottom" />
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid>