10 Answers, 1 is accepted
0
Elliott
Top achievements
Rank 2
answered on 02 Feb 2012, 06:52 PM
do you have this at the bottom of your grid?
<ClientSettings> <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelected="ItemsRowSelected" /></ClientSettings>0
Jocelyn
Top achievements
Rank 1
answered on 02 Feb 2012, 07:17 PM
No I didn't. But now, how can I associate the event with a function inside my aspx.vb?
0
Elliott
Top achievements
Rank 2
answered on 02 Feb 2012, 07:25 PM
check out this post
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/selectedindexchanged-event-of-radgrid.aspx
look at Vlad's recommendations
my snippet handled the event on the client
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/selectedindexchanged-event-of-radgrid.aspx
look at Vlad's recommendations
my snippet handled the event on the client
0
Jocelyn
Top achievements
Rank 1
answered on 02 Feb 2012, 07:53 PM
I added EnablePostBackOnRowClick="true" and now the event is fired. But I still get no selectedindexes and after the process in the function the row I clicked is not even selected.... Here is some code:
<div class="fullscreen"> <telerik:RadGrid ID="gridAllergies" runat="server" Width="100%" Skin="WebBlue" style="border:0;outline:none" Height="80%" CellSpacing="0" GridLines="None"> <MasterTableView > <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings> <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn> <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn> <Columns> <telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="PushButton" EditText="Modifier" Resizable="False"> <HeaderStyle Width="75px" /> </telerik:GridEditCommandColumn> <telerik:GridBoundColumn DataField="palg_noauto" FilterControlAltText="Filter column1 column" UniqueName="column1" Visible="False"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="allergie" FilterControlAltText="Filter column2 column" HeaderText="Allergie" SortExpression="allergie" UniqueName="column2" CurrentFilterFunction="StartsWith" FilterDelay="700" ShowFilterIcon="false" > </telerik:GridBoundColumn> <telerik:GridDropDownColumn DataField="gral_description" FilterControlAltText="Filter column column" HeaderText="Groupe" ShowFilterIcon="False" UniqueName="column"> </telerik:GridDropDownColumn> <telerik:GridBoundColumn DataField="Date" FilterControlAltText="Filter column3 column" HeaderText="Date" SortExpression="Date" UniqueName="column3" CurrentFilterFunction="StartsWith" FilterDelay="700" ShowFilterIcon="false" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="palg_texte_2" FilterControlAltText="Filter column4 column" SortExpression="palg_texte_2" UniqueName="column4" CurrentFilterFunction="StartsWith" FilterDelay="700" ShowFilterIcon="false" HeaderText="Texte1" > </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="palg_texte_2" FilterControlAltText="Filter column5 column" HeaderText="Texte2" SortExpression="palg_texte_2" UniqueName="column5" CurrentFilterFunction="StartsWith" FilterDelay="700" ShowFilterIcon="false" > </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"></FilterMenu> <ClientSettings EnablePostBackOnRowClick="true"> <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelected="ItemsRowSelected" /> </ClientSettings> </telerik:RadGrid> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"> </telerik:RadAjaxLoadingPanel> </div>Protected Sub gridAllergies_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles gridAllergies.SelectedIndexChanged Debug.WriteLine("here") End Sub0
Jocelyn
Top achievements
Rank 1
answered on 02 Feb 2012, 08:28 PM
Well I found my problem. I was binding my datasource in the Page_Load, so it was calling it on every post. I added If not isPostBack and now it is working like a charm!
Thanks for your help!
Thanks for your help!
0
Elliott
Top achievements
Rank 2
answered on 02 Feb 2012, 08:32 PM
glad to be of help
do you want to see the dent in my desk that happened for spending a couple of hours trying to figure out why I couldn't find a cell by looking for innerHtml (hint, it's innerHTML)
do you want to see the dent in my desk that happened for spending a couple of hours trying to figure out why I couldn't find a cell by looking for innerHtml (hint, it's innerHTML)
0
Christian
Top achievements
Rank 1
answered on 18 Jun 2014, 02:12 PM
Hallo Elliott,
i have this tags in my grid. I will enable buttons to click, if a row was selected in the grid. But if i click on the button, the grid has no selecteditems. Can you help me?
i have this tags in my grid. I will enable buttons to click, if a row was selected in the grid. But if i click on the button, the grid has no selecteditems. Can you help me?
0
Christian
Top achievements
Rank 1
answered on 18 Jun 2014, 02:14 PM
This tags I used in my grid:
<ClientSettings> <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelected="ItemsRowSelected" /></ClientSettings>
<ClientSettings> <Selecting AllowRowSelect="true" /> <ClientEvents OnRowSelected="ItemsRowSelected" /></ClientSettings>
0
Shinu
Top achievements
Rank 2
answered on 19 Jun 2014, 06:55 AM
Hi Christian,
Please have a look into the sample code snippet which works fine at my end.
ASPX:
JavaScript:
Thanks,
Shinu.
Please have a look into the sample code snippet which works fine at my end.
ASPX:
<telerik:RadGrid ID="rgrdOrders" runat="server" DataSourceID="sqldsOrders" AutoGenerateColumns="false"> <MasterTableView> <Columns> <telerik:GridBoundColumn DataField="OrderID" UniqueName="OrderID" HeaderText="OrderID"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID" HeaderText="CustomerID"> </telerik:GridBoundColumn> </Columns> </MasterTableView> <ClientSettings Selecting-AllowRowSelect="true"> <ClientEvents OnRowSelected="enableButton" /> </ClientSettings></telerik:RadGrid><telerik:RadButton ID="rbtnGetSelectRow" runat="server" Text="SelectedRow" AutoPostBack="false" Enabled="false" OnClientClicked="selectedRow"></telerik:RadButton><asp:SqlDataSource ID="sqldsOrders" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT top 5 [OrderID], [CustomerID] FROM [Orders]"></asp:SqlDataSource>JavaScript:
function enableButton(sender, args) { var button = $find("<%=rbtnGetSelectRow.ClientID%>"); button.set_enabled(true);}function selectedRow(sender, args) { var grid = $find("<%=rgrdOrders.ClientID%>"); alert("Selected Item Index "+ grid.get_selectedItems()[0].get_itemIndex());}Thanks,
Shinu.
0
Christian
Top achievements
Rank 1
answered on 23 Jun 2014, 06:55 AM
Hi Shinu,
thanks for your solution. I used the ASP.NET Button. After I changed the button with the Telerik:RadButton it work well. Additionaly I add "return false;" on my enableButton-Script.
thanks for your solution. I used the ASP.NET Button. After I changed the button with the Telerik:RadButton it work well. Additionaly I add "return false;" on my enableButton-Script.