I have a RadGrid on a website where selecting a row triggers a database look-up and a post-back. When the page refreshes, the row does not appear selected, although the data is retrieved. We can see the row being selected before the post-back completes. I've looked at the Grid "Accessing Cells and Rows" demo and I think this may work for my situation, but I have not been able to set the row background from this example. Anyone have ideas on this? Any help would be appreciated. More details appear below:
(ASPX)
| <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" |
| AllowPaging="True" DataSourceID="LoggerDS" GridLines="None" > |
| <HeaderContextMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"> |
| </CollapseAnimation> |
| </HeaderContextMenu> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <MasterTableView autogeneratecolumns="False" datasourceid="LoggerDS" CommandItemDisplay="Top" HorizontalAlign="Center"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px"></HeaderStyle> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="MDate" DataType="System.DateTime" ItemStyle-HorizontalAlign="Center" |
| HeaderText="Date" SortExpression="MDate" UniqueName="MDate"> |
| <ItemStyle HorizontalAlign="Center"></ItemStyle> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="CallID" DataType="System.Int32" ItemStyle-HorizontalAlign="Center" |
| HeaderText="Call ID" SortExpression="CallID" UniqueName="CallID" Display="False"> |
| <ItemStyle HorizontalAlign="Center"></ItemStyle> |
| </telerik:GridBoundColumn> |
| ... |
| </Columns> |
| <PagerStyle Mode="NextPrevAndNumeric" /> |
| <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" |
| Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" |
| Wrap="True" /> |
| <CommandItemTemplate> |
| <asp:Button ID="SelectButton" runat="server" Text="Review Selected Call" OnClientClick="return LoadReviewForm();" /> |
| </CommandItemTemplate> |
| </MasterTableView> |
| <FilterMenu> |
| <CollapseAnimation Type="OutQuint" Duration="200"> |
| </CollapseAnimation> |
| </FilterMenu> |
| <ClientSettings EnablePostBackOnRowClick="true"> |
| <Selecting AllowRowSelect="True"></Selecting> |
| </ClientSettings> |
| </telerik:RadGrid> |
(ASPX.VB)
| Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles RadGrid1.ItemCommand |
| If (e.CommandName = "RowClick" AndAlso TypeOf e.Item Is GridDataItem) Then |
| e.Item.Selected = True |
| e.Item.BackColor = Drawing.Color.DarkGray |
| ... |