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

Combobox inside GridTemplateColumn

1 Answer 157 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 31 May 2013, 10:51 PM
Hi,

I am trying to check some combo items from a Radcombobox inside a GridTemplateColumn but unfortunately I cannot get it to work. Instead when I directly set the checked attribute on a checkbox I obtain the correct functionality. The RadGrid is bound to a datasource which all combo items are defined with boolean values (SyncVariantLocalizations, SyncVariantPictures, etc).

Code working:
<asp:CheckBox ID="CheckBox5" runat="server" Enabled="false" Checked='<%# Eval("SyncVariantLocalizations")%>' />

Code not working:
<telerik:GridTemplateColumn UniqueName="SyncSetting" HeaderText="Sync Settings" HeaderStyle-Width="232">
                                    <ItemTemplate>
                                        <div style="float: right;">
                                            <telerik:RadComboBox ID="RadComboBoxSyncConf" runat="server" Width="220px" CheckBoxes="true" EnableCheckAllItemsCheckBox="false" DropDownAutoWidth="Enabled">
                                                <Items>
                                                    <telerik:RadComboBoxItem Text="Product Localizations" Value="SyncProductLocalizations" Checked='<%# Eval("SyncProductLocalizations")%>' Enabled="false" />
                                                    <telerik:RadComboBoxItem Text="Product Pictures" Value="SyncProductPictures" Checked='<%# Eval("SyncProductPictures")%>' Enabled="false" />
                                                    <telerik:RadComboBoxItem Text="Product Categories" Value="SyncProductCategoryMap" Checked='<%# Eval("SyncProductCategoryMap")%>' />
                                                    <telerik:RadComboBoxItem Text="Product Manufacturers" Value="SyncProductManufacturerMap" Checked='<%# Eval("SyncProductManufacturerMap")%>' />
                                                    <telerik:RadComboBoxItem Text="Variant Localizations" Value="SyncVariantLocalizations" Checked='<%# Eval("SyncVariantLocalizations")%>' />
                                                    <telerik:RadComboBoxItem Text="Variant Pictures" Value="SyncVariantPictures" Checked='<%# Eval("SyncVariantPictures")%>' />
                                                    <telerik:RadComboBoxItem Text="Variant Attributes" Value="SyncVariantCustomAttributes" Checked='<%# Eval("SyncVariantCustomAttributes")%>' />
                                                </Items>
                                            </telerik:RadComboBox>
                                        </div>
                                    </ItemTemplate>
 
                                </telerik:GridTemplateColumn>


Thanks.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 01 Jun 2013, 05:17 AM
Hello,

When you used "Eval" in RadComboBox at that time,Then .net is try/trying to find this item's in RadComboBox's DataSource. not in RadGrid's DataSource.

As per your code, you do not assigned any DataSource in RadComboBox That's why you got this issue.

Correct Code:

<telerik:GridTemplateColumn UniqueName="SyncSetting" HeaderText="Sync Settings" HeaderStyle-Width="232">
                       <ItemTemplate>
                           <div style="float: right;">
                               <telerik:RadComboBox ID="RadComboBoxSyncConf" runat="server" Width="220px" CheckBoxes="true"
                                   EnableCheckAllItemsCheckBox="false" DropDownAutoWidth="Enabled" SelectedValue='<%# Eval("SyncProductLocalizations")%>'>
                                   <Items>
                                       <telerik:RadComboBoxItem Text="Product Localizations" Value="SyncProductLocalizations"
                                           Enabled="false" />
                                   </Items>
                               </telerik:RadComboBox>
                           </div>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>


In-Correct Code
<telerik:GridTemplateColumn UniqueName="SyncSetting" HeaderText="Sync Settings" HeaderStyle-Width="232">
                       <ItemTemplate>
                           <div style="float: right;">
                               <telerik:RadComboBox ID="RadComboBoxSyncConf" runat="server" Width="220px" CheckBoxes="true"
                                   EnableCheckAllItemsCheckBox="false" DropDownAutoWidth="Enabled" SelectedValue="0">
                                   <Items>
                                       <telerik:RadComboBoxItem Text="Product Localizations" Value="SyncProductLocalizations"
                                           Checked='<%# Eval("SyncProductLocalizations")%>' Enabled="false" />
                                   </Items>
                               </telerik:RadComboBox>
                           </div>
                       </ItemTemplate>
                   </telerik:GridTemplateColumn>


Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Marc
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or