4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 12 Feb 2010, 05:41 AM
Hi Shyam,
I guess you have DropDownList placed in EditItemTemplate of GridTemplateColumn like this.
aspx:
You can attach 'SelectedIndexChanged' event to dropdownlist and execute the query, and set the DataSource of grid to populate it.
cs:
Regards,
Shinu.
I guess you have DropDownList placed in EditItemTemplate of GridTemplateColumn like this.
aspx:
| <telerik:GridTemplateColumn> |
| <ItemTemplate> |
| </ItemTemplate> |
| <EditItemTemplate> |
| <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" |
| onselectedindexchanged="DropDownList1_SelectedIndexChanged"> |
| <asp:ListItem Text="1"></asp:ListItem> |
| <asp:ListItem Text="2"></asp:ListItem> |
| </asp:DropDownList> |
| </EditItemTemplate> |
| </telerik:GridTemplateColumn> |
You can attach 'SelectedIndexChanged' event to dropdownlist and execute the query, and set the DataSource of grid to populate it.
cs:
| protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) |
| { |
| DropDownList dropdown = (DropDownList)sender; |
| dropdown.SelectedValue.ToString(); |
| string str = dropdown.SelectedValue.ToString(); //for geting the selected item |
| string sql = "SELECT * from Categories WHERE CategoryName='" + str+"'"; |
| SqlDataAdapter adapter = new SqlDataAdapter(sql, ConfigurationManager.ConnectionStrings["NorthwindConnectionString"].ConnectionString); |
| DataTable dt = new DataTable(); |
| adapter.Fill(dt); |
| RadGrid1.DataSource = dt; |
| RadGrid1.Rebind(); |
| } |
Regards,
Shinu.
0
shyam k
Top achievements
Rank 1
answered on 12 Feb 2010, 03:50 PM
Hey Shinu,
Thanks for the code...
Thanks for the code...
0
shyam k
Top achievements
Rank 1
answered on 12 Feb 2010, 04:36 PM
HI Shinu,
Iam getting the following error when i try to use the code in runtime....
Invalidoperation exception was unhandled by the user code
object cannot be enumerated more than once.
Iam actually displaying a set of items in radgrid based on dropdown selected item.....
Is there anything that i can check to get it work...
Iam getting the following error when i try to use the code in runtime....
Invalidoperation exception was unhandled by the user code
object cannot be enumerated more than once.
Iam actually displaying a set of items in radgrid based on dropdown selected item.....
Is there anything that i can check to get it work...
0
Hi shyam,
Could you please provide a runnable code or share the problematic page whole code?
Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Could you please provide a runnable code or share the problematic page whole code?
Best wishes,
Iana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.