Sagar Baheti
Top achievements
Rank 1
Sagar Baheti
asked on 19 Sep 2008, 06:55 AM
Hi,
I am using RadGrid control, and i am having Asp DropdownnList control inside the every grid row. Now on selecting every action from DropDownList i entered to DropDownList_SelectedIndexChanged event but here i am not able to find Grid row cell values. Could you please help me for that.
Thanks ,
Sagar
I am using RadGrid control, and i am having Asp DropdownnList control inside the every grid row. Now on selecting every action from DropDownList i entered to DropDownList_SelectedIndexChanged event but here i am not able to find Grid row cell values. Could you please help me for that.
Thanks ,
Sagar
10 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 19 Sep 2008, 07:16 AM
Hello Sagar,
Try out the following code to access a cell in the grid row on the SelectedIndexChanged event of DropDownList.
aspx:
Princy.
cs:
Try out the following code to access a cell in the grid row on the SelectedIndexChanged event of DropDownList.
aspx:
<telerik:GridTemplateColumn UniqueName="TemplateColumn"> |
<ItemTemplate> |
<asp:DropDownList ID="DropDownList1" AutoPostBack="true" DataTextField="Place" DataSourceID="SqlDataSource1" DataValueField="Place" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"> |
</asp:DropDownList> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name" > |
</telerik:GridBoundColumn> |
Princy.
cs:
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) |
{ |
DropDownList ddl = (DropDownList)sender; |
GridDataItem dataItem = (GridDataItem)ddl.NamingContainer; |
string strText = dataItem["Name"].Text; |
} |
0
Phil
Top achievements
Rank 2
answered on 13 Feb 2009, 05:59 PM
Thank-you, thank-you and thank-you
0
[Nean]
Top achievements
Rank 1
answered on 16 Mar 2009, 02:25 PM
Hi,
I have a similar problem.
I have a RadComboBox in a RadGrid. In the function fired by the SelectedIndexChanged (client-side), I want to get the parent row of my control. How can I do that ? In fact I want to change the text of a RadTextBox in the same row but in another cell without a postback.
Thanxs,
[Nean]
I have a similar problem.
I have a RadComboBox in a RadGrid. In the function fired by the SelectedIndexChanged (client-side), I want to get the parent row of my control. How can I do that ? In fact I want to change the text of a RadTextBox in the same row but in another cell without a postback.
Thanxs,
[Nean]
0
Hi [Nean],
How this can be done with AJAX request instead of postback you can see from the following examples:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/gridreferencecontrolsinroweditform.html
To perform the same operation purely on the client, you will need to obtain reference to the respective GridDataItem client object and invoke its findControl() or findElement() method based on the context (whether you would like to find ASP.NET AJAX control or html element in the row). Then you will need to change its value using the client API of the control or plain javascript.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
How this can be done with AJAX request instead of postback you can see from the following examples:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/gridreferencecontrolsinroweditform.html
To perform the same operation purely on the client, you will need to obtain reference to the respective GridDataItem client object and invoke its findControl() or findElement() method based on the context (whether you would like to find ASP.NET AJAX control or html element in the row). Then you will need to change its value using the client API of the control or plain javascript.
Kind regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
[Nean]
Top achievements
Rank 1
answered on 16 Mar 2009, 02:46 PM
Thanks for your answer.
The two exemple you gave to me seems to use server-side programming.
You said "To perform the same operation purely on the client, you will need to obtain reference to the respective GridDataItem client object...". It's precisely my question. How can I get the GridDataItem wich contains my RadCOmboBox in the ClientSelectedIndexChanged event ?
[Nean]
The two exemple you gave to me seems to use server-side programming.
You said "To perform the same operation purely on the client, you will need to obtain reference to the respective GridDataItem client object...". It's precisely my question. How can I get the GridDataItem wich contains my RadCOmboBox in the ClientSelectedIndexChanged event ?
[Nean]
0
[Nean]
Top achievements
Rank 1
answered on 16 Mar 2009, 03:34 PM
To be more precise...
I have a RadGrid. This RadGrid contains two columns. One with a RadComboBox and another with a RadTextBox. So the RadComboBox and the RadTextBox are repeated for each GridRow.
I have a function attached to the SelectedIndexChanged of this RadComboBox.
In this function I want to get the value of the RadComboBox and copy it into a the RadTextBox in the same row (but in a different column). All of this client -side (because it's a huge application which is already too slow, so i don't want another postback even with ajax).
Thanks,
[Nean]
I have a RadGrid. This RadGrid contains two columns. One with a RadComboBox and another with a RadTextBox. So the RadComboBox and the RadTextBox are repeated for each GridRow.
I have a function attached to the SelectedIndexChanged of this RadComboBox.
In this function I want to get the value of the RadComboBox and copy it into a the RadTextBox in the same row (but in a different column). All of this client -side (because it's a huge application which is already too slow, so i don't want another postback even with ajax).
Thanks,
[Nean]
0
[Nean]
Top achievements
Rank 1
answered on 17 Mar 2009, 07:38 AM
Hi everyone,
I was wondering if it wasn't possible to reach the row in wich my RadCOmboBox is using the get_parent() method ? But the direct parent of my RadComboBox doesn't seem to be the row neither the cell of the RadGrid. Is there another method that can do that ? I'm sorry, but i'm a beginner, so maybe this question is obvious but I can't find the solution.
Thanks,
[Nean]
I was wondering if it wasn't possible to reach the row in wich my RadCOmboBox is using the get_parent() method ? But the direct parent of my RadComboBox doesn't seem to be the row neither the cell of the RadGrid. Is there another method that can do that ? I'm sorry, but i'm a beginner, so maybe this question is obvious but I can't find the solution.
Thanks,
[Nean]
0
Phil
Top achievements
Rank 2
answered on 17 Mar 2009, 11:20 PM
Sub codeComboBox_SelectedIndexChanged(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
' Combo in detail table
Dim _comboBox As RadComboBox = TryCast(o, RadComboBox)
Dim _parentItem As GridDataItem = _comboBox.NamingContainer.Parent.ParentItem
...
' Combo in detail table
Dim _comboBox As RadComboBox = TryCast(o, RadComboBox)
Dim _parentItem As GridDataItem = _comboBox.NamingContainer.Parent.ParentItem
...
0
[Nean]
Top achievements
Rank 1
answered on 18 Mar 2009, 07:25 AM
Hi Phil,
Thanks for your answer but I'm looking for a way to do that client-side. Any idea ?
[Nean]
0
Hello [Nean],
I think that the project from the following code library thread will help you attain the functionality you are after:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/get-value-of-another-control-client-side.aspx
Review the code implementation from the example with _Web_UI suffix for more details.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I think that the project from the following code library thread will help you attain the functionality you are after:
http://www.telerik.com/community/code-library/aspnet-ajax/grid/get-value-of-another-control-client-side.aspx
Review the code implementation from the example with _Web_UI suffix for more details.
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.