I am working with a Grid. I use the client side row selection but, when I try to get the selected item (server side) the "SelectedIndexes.count" is always 0 (zero) although I have a row selected. What can I do???
DGRID CODE
| <telerik:RadGrid ID="CnsGrid" runat="server" Style="position: static" AllowFilteringByColumn="True" |
| AllowPaging="True" AllowSorting="True" GridLines="None" PageSize="15" ShowGroupPanel="True" Skin="Simple" AllowCustomPaging="True"> |
| <GroupPanel Text="Arrastre un título de columna aquí para agrupar por dicha columna"> |
| </GroupPanel> |
| <PagerStyle FirstPageToolTip="Primera página" LastPageToolTip="Ùltima Página" |
| NextPagesToolTip="Próximas Páginas" NextPageToolTip="Próxima Página" |
| PrevPagesToolTip="Página Anterior" PrevPageToolTip="Página Anterior" PagerTextFormat="Cambiar página: {4} &nbsp;Página <strong>{0}</strong> de <strong>{1}</strong>, items <strong>{2}</strong> a <strong>{3}</strong> de <strong>{5}</strong>." /> |
| <GroupingSettings CollapseTooltip="Contraer grupo" ExpandTooltip="Expandir grupo" |
| GroupContinuedFormatString="... grupo viene de la página anterior" GroupContinuesFormatString="Grupo continua en la siguiente página..." |
| ShowUnGroupButton="True" UnGroupButtonTooltip="Click aqui para desagrupar" UnGroupTooltip="Arrastre fuera para eliminar el grupo por dicha columna" /> |
| <SortingSettings SortedAscToolTip="Orden Asc" SortedDescToolTip="Orden Desc" SortToolTip="Clic aquí para ordenar" /> |
| <StatusBarSettings LoadingText="Cargando..." ReadyText="Listo" /> |
| <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
| <HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" /> |
| <FilterItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
| <AlternatingItemStyle HorizontalAlign="Center" VerticalAlign="Middle" /> |
| <ClientSettings EnableRowHoverStyle="True"> |
| <Selecting AllowRowSelect="True" /> |
| </ClientSettings> |
| <SelectedItemStyle BackColor="#FFC080" /> |
| </telerik:RadGrid> |
VB CODE
| Dim ArrRes() As String = Nothing |
| Dim index As Integer |
| Session("Cns_sn_cancel") = False |
| Try |
| For index = 2 To CnsGrid.Items(Me.CnsGrid.SelectedIndexes(0)).Cells.Count - 1 |
| 'HERE I ALWAYS GET AN ERROR |
| 'BECAUSE THERE'S NO ROW SELECTED |
| ReDim Preserve ArrRes(index) |
| ArrRes(index - 2) = CnsGrid.Items(Me.CnsGrid.SelectedIndexes(0)).Cells(index).Text |
| Next |
| Session("ResConsulta") = ArrRes |
| Catch ex As Exception |
| Session("CNS_sn_error") = True |
| Session("Cns_error") = ex.Message.ToString |
| Finally |
| Dim strScript As String |
| strScript = "<script language=javascript> " |
| strScript += "window.close();" |
| strScript += "</script>" |
| ClientScript.RegisterStartupScript(Me.Page.GetType(), "CierraConsulta", strScript) |
| End Try |