Najid Hanif
Top achievements
Rank 2
Najid Hanif
asked on 15 Sep 2011, 11:27 PM
Hi, In my grid I have 2 drop downs. I would like to either change the values or not let the grid be updated depending on what has been selected in the drop downs.
For example:
If the status drop down = unassigned then the assignedto drop down also has to = unassigned.
If the status drop down = assigned then the assignedto drop down can't = unassigned.
What is the best way to go about doing this?
Thanks
For example:
If the status drop down = unassigned then the assignedto drop down also has to = unassigned.
If the status drop down = assigned then the assignedto drop down can't = unassigned.
What is the best way to go about doing this?
Thanks
4 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 16 Sep 2011, 06:40 AM
Hello Najid,
I am not very clear about your requirement and as far as I understood you want to set the values of second dropdown based on the selected value of the first combobox.
Here is a sample code to achieve the requirement.
C#:
C#:
Please elaborate your scenario if it doesn't helps.
Thanks,
Shinu.
I am not very clear about your requirement and as far as I understood you want to set the values of second dropdown based on the selected value of the first combobox.
Here is a sample code to achieve the requirement.
C#:
<
telerik:GridTemplateColumn
UniqueName
=
"ContactTitle"
HeaderText
=
"ContactTitle"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
AutoPostBack
=
"true"
runat
=
"serverOnSelectedIndexChanged="
RadComboBox1_SelectedIndexChanged">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
UniqueName
=
"TemplateColumn"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox2"
runat
=
"server"
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
protected
void
RadComboBox1_SelectedIndexChanged(
object
o, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox rdcbx = (RadComboBox)o;
GridEditableItem editedItem = rdcbx.NamingContainer
as
GridEditableItem;
RadComboBox ddList = editedItem.FindControl(
"RadComboBox2"
)
as
RadComboBox;
// change the data source for ddList here
.....
}
Please elaborate your scenario if it doesn't helps.
Thanks,
Shinu.
0
You may also review the implementations in these two live demos, guys:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridwithtreeviewcomboboxeditors/defaultcs.aspx?product=grid
Greetings,
Sebastian
the Telerik team
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/accessingcellsandrows/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridwithtreeviewcomboboxeditors/defaultcs.aspx?product=grid
Greetings,
Sebastian
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
0
Najid Hanif
Top achievements
Rank 2
answered on 19 Sep 2011, 08:22 PM
Sorry this does not help much. Let me put it this may. How can I code this:
OnSelectedIndexChanged
If value of dropdown1 == "X" then Update selection of dropdown2 to "X"
Note: I don't need to repopulate the drop down contents based on selection.
OnSelectedIndexChanged
If value of dropdown1 == "X" then Update selection of dropdown2 to "X"
Note: I don't need to repopulate the drop down contents based on selection.
0
Accepted
Princy
Top achievements
Rank 2
answered on 20 Sep 2011, 08:37 AM
Hello Najid,
You can set the selectedvalue as follows.
C#:
Thanks,
Princy.
You can set the selectedvalue as follows.
C#:
protected
void
RadCombobox1_SelectedIndexChanged(
object
sender, RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox rdcbx = (RadComboBox)sender;
GridEditableItem editedItem = rdcbx.NamingContainer
as
GridEditableItem;
RadComboBox ddList = editedItem.FindControl(
"RadCombobox2"
)
as
RadComboBox;
if
(rdcbx.SelectedValue ==
"2"
)
//sample value
{
ddList.SelectedValue =
"2"
;
}
}
Thanks,
Princy.