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

How to use the RadComboBox with EnableLoadOnDemand inside EditItemTemplate of RadGrid

1 Answer 270 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajiv
Top achievements
Rank 1
Rajiv asked on 09 Dec 2008, 03:51 AM
Hello,
    I have a hierarchial radgrid where the details tables have the option of Add/Edit & delete records. This is implemented using the automatic data source operations. In add/edit mode, one field is shown using the RadCombo box with 500+ records. All the required functionality is working fine but the overall performance of the grid is slow.

To improve the performance of the grid, I am in the process of modifying the RadCombo box to EnableLoadOnDemand. The LoadOnDemand functionality is working fine but I am having issues with the Add & edit operations. Below is the code extract for the same:

<

EditItemTemplate>

 

<

telerik:RadComboBox ID="RadComboBoxEmps"

 

 

runat="Server" MarkFirstMatch="True" AppendDataBoundItems="True" EnableLoadOnDemand="True" OnItemsRequested="RadComboBoxEmps_ItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting">

 

 

</telerik:RadComboBox>

 

</

EditItemTemplate>

 


In the RadComboBoxEmps_ItemsRequested event, I have added the code to populate this Radcombo box using a datareader.
But When I attempt to Add a new record or update existsing record, the SP responsible for insert/ Update throws a error saying that value for one of the field is NULL. And that field is refering to the value of the above RadCombo. i.e. for some reason the Value of  selected item of the radcombo box is sent as null to the Insert SP. And I am sure that none of the Value in the RadCombo box is Null as it is populated from a master table.

I have following questions with this regards:

1. Will Radcombo box with  EnableLoadOnDemand=true work with automatic data source operations for Add/edit & delete? I  have seen some samples for EnableLoadOnDemand but I couldn't find any sample for it with automatic data source.

2. How will the automatic data source operations know that the above Radcombo box is mapped to some field in InsertParameters & UpdateParameters of SQLDatasource?

3. Do I have to write some code in the Itemdatabound event for the edit operations?

Please help me fix this issue.

Thanks,
Rajiv

1 Answer, 1 is accepted

Sort by
0
Nikita Gourme
Top achievements
Rank 1
answered on 11 Dec 2008, 02:41 PM
Rajiv, I read somewhere that the SelectedValue is not applicable when you enable load on demand for Telerik combobox. Instead try to bind the Text value of the comboxes using two-way binding as follows:

<telerik:RadComboBox ID="RadComboBoxEmps"   
 runat="Server" MarkFirstMatch="True" AppendDataBoundItems="True"  EnableLoadOnDemand="True" OnItemsRequested="RadComboBoxEmps_ItemsRequested" OnClientItemsRequesting="OnClientItemsRequesting" Text='<%# Bind("[MySourceFieldName]")%>'>   
</telerik:RadComboBox>   
 

This setting will probably do the trick if you set DataSourceID/DataTextField/DataValueField declaratively for the combo. To map the combobox to the source field, set Update/Insert parameter in the same way as shown in the automatic operations demos.

Nikita
Tags
Grid
Asked by
Rajiv
Top achievements
Rank 1
Answers by
Nikita Gourme
Top achievements
Rank 1
Share this question
or