This is a migrated thread and some comments may be shown as answers.

Disable/Enable telerik:RadComboBox within telerik:RadGrid data item when client selection is changed

7 Answers 317 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Nhilesh
Top achievements
Rank 1
Nhilesh asked on 26 Feb 2009, 08:31 PM
I am using the new Q2 2008 release, and I want to Disable/Enable telerik:RadComboBox within telerik:RadGrid data item when client selection is changed. Please let me know what's the best solution for the same.

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

Sort by
0
Veselin Vasilev
Telerik team
answered on 02 Mar 2009, 12:07 PM
Hello Nhilesh,

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.
0
Nhilesh
Top achievements
Rank 1
answered on 02 Mar 2009, 12:27 PM

 

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

0
Veselin Vasilev
Telerik team
answered on 03 Mar 2009, 09:30 AM
Hi 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.
0
Nhilesh
Top achievements
Rank 1
answered on 03 Mar 2009, 12:27 PM
Hi Veselin Vasilev,

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
0
Veselin Vasilev
Telerik team
answered on 04 Mar 2009, 09:09 AM
Hello Nhilesh,

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.
0
Nhilesh
Top achievements
Rank 1
answered on 04 Mar 2009, 09:25 AM

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

0
Veselin Vasilev
Telerik team
answered on 07 Mar 2009, 09:16 AM
Hello 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.
Tags
ComboBox
Asked by
Nhilesh
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Nhilesh
Top achievements
Rank 1
Share this question
or