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

Radcombobox Selected valuew not working inside a radgrid

2 Answers 99 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suneetha
Top achievements
Rank 1
Suneetha asked on 29 May 2012, 06:38 PM
Hi,

I have a radgrid with 5 radcomboboxes inside edoit item itemplate.In the edit mode of radgrid the selected value property of combobox working for only two combo boxes but not for other.Please anybody give4 me the solution.Here is my radgrid sourcecode

<

 

 

telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AutoGenerateColumns="False"

 

 

 

CellSpacing="0" GridLines="None" Height="520px" OnNeedDataSource="RadGrid1_NeedDataSource"

 

 

 

OnUpdateCommand="RadGrid1_UpdateCommand" PageSize="20" Skin="WebBlue" Visible="False"

 

 

 

OnPreRender="RadGrid1_PreRender">

 

 

 

<ClientSettings>

 

 

 

<Selecting CellSelectionMode="None" />

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

 

 

</ClientSettings>

 

 

 

<MasterTableView DataKeyNames="ITEM_NUMBER" Width="100%">

 

 

 

<CommandItemSettings ExportToPdfText="Export to PDF" />

 

 

 

<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">

 

 

 

</RowIndicatorColumn>

 

 

 

<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">

 

 

 

</ExpandCollapseColumn>

 

 

 

<Columns>

 

 

 

<telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Edit" HeaderStyle-Width="4%"

 

 

 

HeaderText="Edit" Text="Edit" UniqueName="EditButton" Visible="true">

 

 

 

<HeaderStyle Width="4%" />

 

 

 

</telerik:GridButtonColumn>

 

 

 

<telerik:GridBoundColumn DataField="Total Items" FilterControlAltText="Filter Total_Items column"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Mapped Items"

 

 

 

ReadOnly="true" SortExpression="Total_Items" UniqueName="Total_Items">

 

 

 

<HeaderStyle Font-Bold="True" Width="6%" />

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn EditFormHeaderTextFormat="&lt;font color='red'&gt;*&lt;/font&gt;{0}"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Ariba_Cat1" UniqueName="Ariba_Cat1">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbl_catone" runat="server" Text='<%#Eval("Ariba_Cat1") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="rcb_aribacatone" runat="server" DataSourceID="Ariba_Cat1"

 

 

 

DataTextField="ariba_cat1" DataValueField="ariba_cat1">

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

<HeaderStyle Font-Bold="True" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn EditFormHeaderTextFormat="&lt;font color='red'&gt;*&lt;/font&gt;{0}"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Ariba_Cat2" UniqueName="Ariba_Cat2">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbl_cattwo" runat="server" Text='<%#Eval("Ariba_Cat2") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="rcb_aribacattwo" runat="server" DataSourceID="aribacat2"

 

 

 

DataTextField="ariba_cat2" DataValueField="ariba_cat2" >

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

<HeaderStyle Font-Bold="True" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn EditFormHeaderTextFormat="&lt;font color='red'&gt;*&lt;/font&gt;{0}"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Ariba_Cat3" UniqueName="Ariba_Cat3">

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbl_catthree" runat="server" Text='<%#Eval("Ariba_Cat3") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="rcb_aribacatthree" runat="server" DataSourceID="SubCategory"

 

 

 

DataTextField="ariba_cat3" DataValueField="ariba_cat3" >

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

<HeaderStyle Font-Bold="True" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn EditFormHeaderTextFormat="&lt;font color='red'&gt;*&lt;/font&gt;{0}"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Ariba_Cat4" UniqueName="Ariba_Cat4">

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="rcb_aribacatfour" runat="server" DataSourceID="ds_aribafour"

 

 

 

DataTextField="ariba_cat4" DataValueField="ariba_cat4" SelectedValue='<%# Bind("Ariba_Cat4") %>'>

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbl_catfour" runat="server" Text='<%#Eval("Ariba_Cat4") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<HeaderStyle Font-Bold="True" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn EditFormHeaderTextFormat="&lt;font color='red'&gt;*&lt;/font&gt;{0}"

 

 

 

HeaderStyle-Font-Bold="true" HeaderStyle-Width="6%" HeaderText="Ariba_Cat5" UniqueName="Ariba_Cat5">

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="rcb_aribacatfive" runat="server" DataSourceID="ds_catfive"

 

 

 

DataTextField="ariba_cat5" DataValueField="ariba_cat5" SelectedValue='<%# Bind("Ariba_Cat5") %>'>

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="lbl_catfive" runat="server" Text='<%#Eval("Ariba_Cat5") %>'></asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<HeaderStyle Font-Bold="True" />

 

 

 

<ItemStyle HorizontalAlign="Left" />

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

<EditFormSettings>

 

 

 

<EditColumn FilterControlAltText="Filter EditCommandColumn column">

 

 

 

</EditColumn>

 

 

 

</EditFormSettings>

 

 

 

</MasterTableView>

 

 

 

<FilterMenu EnableImageSprites="False">

 

 

 

</FilterMenu>

 

 

 

</telerik:RadGrid>

 

 while clicking on edit button getting below error.

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Selection out of range
Parameter name: value

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 May 2012, 02:31 PM
Hi,

The issue is because the field value you are setting for the ItemTemplate (for eg:-'Ariba_Cat5') is not found in the items in RadComboBox. Thats why when you are trying to set the SelectedValue for that radComboBox it showing selection out of range error. Please make sure the SelectedValue of RadComboBox included in DataSouce of RadComboBox.

Thanks,
Princy.
0
Suneetha
Top achievements
Rank 1
answered on 31 May 2012, 06:34 PM
Thanks Princy.
Tags
Grid
Asked by
Suneetha
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Suneetha
Top achievements
Rank 1
Share this question
or