Requirement is to disable and reset the combo box when the checkbox [
telerik
:GridClientSelectColumn] is unchecked. and ViceVersa
-Thanks
Nhilesh
7 Answers, 1 is accepted
You can subscribe to the OnRowSelected / OnRowDeselected client events of the grid, find the combobox and enable / disable it.
Here is a sample code for the OnRowSelected event handler:
function OnRowSelectedHandler(sender, e) |
{ |
var dataItem = e.get_gridDataItem(); |
var combo = dataItem.findControl("RadComboBox1"); |
combo.enable(); |
} |
Similarly, you can define the handler of the OnRowDeselected event - just call the disable() method of the combobox.
I hope this will get you started.
Sincerely yours,
Veselin Vasilev
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.
Hi Veselin Vasilev,
The following is the code I have implemented as per the suggestion in the last post, however I get the dataitem it self as a null value.
function RowSelected(sender, eventArgs)
{
var dataItem = eventArgs.get_gridDataItem();
var combo = dataItem.findControl("ddlClass");
combo.enable();
}
function
RowDeselected(sender, eventArgs)
{
var dataItem = eventArgs.get_gridDataItem();
var combo = dataItem.findControl("ddlClass");
combo.disable();
}
Where "ddlClass" is the name of RADComboBox I am using within the grid.
Do you see any problem with the current implementation? Please suggest.
-Thanks
Nhilesh
I forgot to mention that in order to use the get_gridDataItem method you need to subscribe to the OnRowsCreated client event:
<ClientEvents OnRowSelected="OnRowSelectedHandler" |
OnRowCreated="OnRowCreatedHandler" |
OnRowDeselected="OnRowDeselectedHandler" /> |
function OnRowCreatedHandler(sender, e) |
{ } |
You can find more information here: OnRowSelected
All the best,
Veselin Vasilev
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.
This seems to be working, I have implemented this on one page, and it works as expected.
However I have noticed that, combo boxes are disabled after a short delay(may be after 2 seconds, I am not precise on that).
Can this delay be avoided?
FYI: I am calling my data binding method on page_load event and I see the comboboxes are getting disabled after the data is loaded.
-Thannnnnnks
Regards,
Nhilesh Baua
Maybe you need to disable them by default in the aspx page by setting the Enabled property to False. Then you can enable the combos residing in the selected row.
If it is not acceptable for you please send us a small running project demonstrating the issue.
Best wishes,
Veselin Vasilev
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.
Hi Veselin Vasilev,
Can we disable the combo boxes by default on OnRowCreated event itself?
I assume the implementation as under should also work fine.
function
RowSelected(sender, eventArgs){
var dataItem = eventArgs.get_gridDataItem();
var combo = dataItem.findControl("ddlClass");
combo.enable();
}
function RowDeselected(sender, eventArgs){
var dataItem = eventArgs.get_gridDataItem();
var combo = dataItem.findControl("ddlClass");
combo.disable();
}
function RowCreated(sender, eventArgs){
var dataItem = eventArgs.get_gridDataItem();
var combo = dataItem.findControl("ddlClass");
combo.disable();
}
Please suggest.
Regards,
-Nhilesh
I think this would be the slower method. You can try both ways and decide which one is suitable for your scenario.
All the best,
Veselin Vasilev
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.