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

[Solved] Grid Template Combox Update

4 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
The KID
Top achievements
Rank 2
The KID asked on 10 Jun 2008, 09:08 PM
I have a template column in a grid, the item template is using an asp:label and the edit mode is using a radcombobox. When i try to update an item i loose the value and  updates to null. I'm using automatic updates/inserts/deletes on my grid.

Everything worked fine before when i was just using a drop down column on the grid but i wanted to allow custom text on the combo box. I would prefer to allow custom text with the dropdown column but i couldn't figure out how so i switched to a template column.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Jun 2008, 06:47 AM
Hi Mike,

Try setting the DropDownControlType to RadComboBox for the DropDownColumn as shown below.

ASPX:
<telerik:GridDropDownColumn DropDownControlType="RadComboBox"  ></telerik:GridDropDownColumn> 


Thanks
Shinu.
0
The KID
Top achievements
Rank 2
answered on 11 Jun 2008, 02:32 PM
Hi Shinu

Yes i have tried that. I also tried placing a GridDropDownListColumnEditor on the page to see if that gave me the option of allowing custom text but still no luck. I'm thinking that i just might be forced to use a template column, then go and be forced to write my own inserts/updates for this situation.

Mike
0
Accepted
Shinu
Top achievements
Rank 2
answered on 12 Jun 2008, 05:27 AM
Hi Mike,

Try accessing the RadComboBox in the ItemDataBound event and set the AlllowCustomText property to true as shown below.

ASPX:
 <telerik:GridDropDownColumn  HeaderText="DropCol"  UniqueName="DropCol"  DropDownControlType="radcombobox"  ></telerik:GridDropDownColumn> 


CS:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            RadComboBox combo = (RadComboBox)item["DropCol"].Controls[0]; 
            combo.AllowCustomText = true
        } 
    } 


Thanks
Shinu.

0
The KID
Top achievements
Rank 2
answered on 12 Jun 2008, 02:06 PM
Thanks!

That's weird that you can set it on the code behind but not on the aspx page. Maybe when i get  a moment i'll send off an email to the telerik suggesting that feature to be included in the next round of controls.

Thanks again

Mike
Tags
Grid
Asked by
The KID
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
The KID
Top achievements
Rank 2
Share this question
or