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

Radgrid binding issue with combobox column

1 Answer 119 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ron
Top achievements
Rank 1
Ron asked on 12 Sep 2013, 09:03 AM
Hi,

I'm having an issue that i spent all day yesterday trying to resolve. I'm hopeful that you can help me. I'm using rad grid and javascript as my data source. My first column which is a combo box wont let me bind. In the rad combo box settings if I set allowcustomtext="false" it will bind but the first item in the grid is automatically selected so that's not what I want. I'd like to have allowcustomtext="true" to give the user the option to enter an item or select an item but when I set allowcustomtext="true" it does not bind. I've attached 2 screen shots. first which allowcustom text false and the other allow custom text true and you can see the difference.
<telerik:GridTemplateColumn DataField="Item" UniqueName="Item">
                   <ItemStyle />
                   <ItemTemplate>
                     <telerik:RadComboBox ID="ddlItems" runat="server" AutoPostBack="false"
                           DataSourceID="objItems" DataTextField="Items" DataValueField="Items"
                           Skin="Silk"  OnClientDropDownOpening="DropDownOpening"
                           OnClientSelectedIndexChanged="ItemValueChanged" EnableViewState="true"
                           AllowCustomText="false"   Width="150px" Height="150px"
                           ondatabound="ddlItems_DataBound" OnItemsRequested="ddlItems_Requested" CssClass="SelectedItem"
                           FocusedStyle-BackColor="#fff6dc" Text='<%# Eval("Item") %>'>
                   </ItemTemplate>
               </telerik:GridTemplateColumn>
thanks,
Ron.

1 Answer, 1 is accepted

Sort by
0
Accepted
Radoslav
Telerik team
answered on 17 Sep 2013, 08:22 AM
Hi Ron,

If you are using the RadGrid with client side data binding you need to assign values to the combo box manually on the client. Also you need manually to set values to the template column's cells when the RadGrid is not in edit mode. On the following link you can find an example of RadGrid client side binding with template column:
http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx
Also more information about client side data binding you can find here:
http://www.telerik.com/help/aspnet-ajax/grid-client-side-binding.html
http://www.telerik.com/help/aspnet-ajax/grid-client-side-binding-specifics.html

I hope this helps.

Regards,
Radoslav
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Ron
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or