Barlet Hamzai
Top achievements
Rank 1
Barlet Hamzai
asked on 05 Mar 2011, 01:24 PM
Hello Telerik Admins and Members,
I have the following problem.
I set EnablePostBackOnRowClick to 'true' I also enable Client-Side row selection and I try the code below
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Text = "Aa";
}
in Label1 nothing changes!
When I do the same thing in VB code it works!
Label1.Text = "Aa" is only for test...
I actually need when I click on row (currently selected row) I want the value to be shown in Label. So I guess I have 2 questions!
Barlet,
Thank you
I have the following problem.
I set EnablePostBackOnRowClick to 'true' I also enable Client-Side row selection and I try the code below
protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
Label1.Text = "Aa";
}
in Label1 nothing changes!
When I do the same thing in VB code it works!
Label1.Text = "Aa" is only for test...
I actually need when I click on row (currently selected row) I want the value to be shown in Label. So I guess I have 2 questions!
Barlet,
Thank you
5 Answers, 1 is accepted
0
Hi Barlet,
Can you confirm that you have registered RadGrid1_SelectedIndexChanged handler for the SelectedIndexChanged event.
I tried the code bellow at it works fine:
Let me know what differs in your case.
Greetings,
Vasil
the Telerik team
Can you confirm that you have registered RadGrid1_SelectedIndexChanged handler for the SelectedIndexChanged event.
I tried the code bellow at it works fine:
<%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title></title></head><body> <form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <telerik:RadCodeBlock runat="server"> <script language="javascript" type="text/javascript"> </script> </telerik:RadCodeBlock> <script runat="server"> protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { RadGrid1.DataSource = new int[] { 1, 2, 3, 4, 5 }; } protected void RadGrid1_SelectedIndexChanged(object sender, EventArgs e) { Label1.Text = Label1.Text + "a"; } </script> <div> <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"> <ClientSettings EnablePostBackOnRowClick="true"> <Selecting AllowRowSelect="true" /> </ClientSettings> </telerik:RadGrid> <asp:Label runat="server" ID="Label1"></asp:Label> </div> </form></body></html>Let me know what differs in your case.
Greetings,
Vasil
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Thomas
Top achievements
Rank 1
answered on 07 Mar 2011, 10:20 PM
Hi!
I have the same problem, I can get you example to work but when I trie it on my page it just want trigger.
Se code:
I have the same problem, I can get you example to work but when I trie it on my page it just want trigger.
Se code:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataMembers" GridLines="None" AllowSorting="True" Skin="Telerik" OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"> <ClientSettings EnablePostBackOnRowClick="True" EnableRowHoverStyle="True"> <Selecting AllowRowSelect="True" /> </ClientSettings> <MasterTableView AutoGenerateColumns="False" DataKeyNames="MemberID" DataSourceID="SqlDataMembers"> <Columns> <telerik:GridBoundColumn DataField="Roles" FilterControlAltText="Filter Roles column" HeaderText="Behörighet" SortExpression="Roles" UniqueName="Roles"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="SocialNumber" FilterControlAltText="Filter SocialNumber column" HeaderText="Personnummer" SortExpression="SocialNumber" UniqueName="SocialNumber"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="FirstName" FilterControlAltText="Filter FirstName column" HeaderText="Förnamn" SortExpression="FirstName" UniqueName="FirstName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="LastName" FilterControlAltText="Filter LastName column" HeaderText="Efternamn" SortExpression="LastName" UniqueName="LastName"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Adress" FilterControlAltText="Filter Adress column" HeaderText="Adress" SortExpression="Adress" UniqueName="Adress"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Zip" FilterControlAltText="Filter Zip column" HeaderText="Postnummer" SortExpression="Zip" UniqueName="Zip"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="ZipAdress" FilterControlAltText="Filter ZipAdress column" HeaderText="Postadress" SortExpression="ZipAdress" UniqueName="ZipAdress"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Phone" FilterControlAltText="Filter Phone column" HeaderText="Mobil" SortExpression="Phone" UniqueName="Phone"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Email" FilterControlAltText="Filter Email column" HeaderText="Email" SortExpression="Email" UniqueName="Email"> </telerik:GridBoundColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"> </EditColumn> </EditFormSettings> <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" /> <AlternatingItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" Wrap="True" /> </MasterTableView> <FilterMenu EnableImageSprites="False"> </FilterMenu> <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"> </HeaderContextMenu> </telerik:RadGrid> <asp:SqlDataSource ID="SqlDataMembers" runat="server" ConnectionString="<%$ ConnectionStrings:Careplan %>" SelectCommand="SELECT * FROM [Members]"></asp:SqlDataSource>0
Barlet Hamzai
Top achievements
Rank 1
answered on 08 Mar 2011, 09:09 AM
Hi Vasil,
The example you showed made me realize that I forgot to add the following code in my .aspx file
Now it is working...
Thank you very much for your feedback...
Barlet
The example you showed made me realize that I forgot to add the following code in my .aspx file
OnSelectedIndexChanged="RadGrid1_SelectedIndexChanged"Now it is working...
Thank you very much for your feedback...
Barlet
0
Thomas
Top achievements
Rank 1
answered on 08 Mar 2011, 09:13 AM
My problem remains, however, even though I have "OnSelectedIndexChanged =" RadGrid1_SelectedIndexChanged "in my code.
Any idees?
Any idees?
0
Hello Thomas,
I am not able to replicate the issue on my side. Could you please open a formal support ticket and send us a sample project that we can debug locally?
Kind regards,
Vasil
the Telerik team
I am not able to replicate the issue on my side. Could you please open a formal support ticket and send us a sample project that we can debug locally?
Kind regards,
Vasil
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!