Hi
I am unable to get the RadGrid EditItemTemplate RadComboBox with checkboxes=ture selected items are empty in RadGrid BatchEdit event. Basically I put the RadComboBox in RadGrid EditItemTemplate and selecting the multiple of RadCombo box and try get those selected item in RadGrid BatchEdit event to save into db, but RadComboBax seletedItems count is empty and I am not able to get the selected items of RadcomboBox.
Instead of RadComboBax if I use the DropDownList I am to get the selected value in Grid BatchEdit event, but my requirement is need to seleted the more than one item so I am using RadComboBox. Here the below is my code.
<telerik:RadListBox RenderMode=
"Lightweight"
runat=
"server"
ID=
"SavedChangesList"
Width=
"600px"
Height=
"200px"
Visible=
"false"
></telerik:RadListBox>
<telerik:RadGrid RenderMode=
"Lightweight"
ID=
"RadGrid1"
GridLines=
"None"
runat=
"server"
AllowAutomaticDeletes=
"True"
AllowAutomaticInserts=
"True"
PageSize=
"10"
OnItemDeleted=
"RadGrid1_ItemDeleted"
OnItemInserted=
"RadGrid1_ItemInserted"
OnPreRender=
"RadGrid1_PreRender"
AllowAutomaticUpdates=
"True"
AllowPaging=
"True"
AutoGenerateColumns=
"False"
DataSourceID=
"SqlDataSource1"
OnBatchEditCommand=
"RadGrid_BatchEditCommand"
>
<MasterTableView CommandItemDisplay=
"TopAndBottom"
DataKeyNames=
"GLAccountMaintenanceID,Region"
DataSourceID=
"SqlDataSource1"
HorizontalAlign=
"NotSet"
AutoGenerateColumns=
"False"
EditMode=
"Batch"
>
<BatchEditingSettings EditType=
"Row"
HighlightDeletedRows=
"true"
/>
<Columns>
<telerik:GridBoundColumn UniqueName=
"GLAccountMaintenanceID"
HeaderText=
"GLAccountMaintenanceID"
DataField=
"GLAccountMaintenanceID"
HeaderStyle-Width=
"50px"
>
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText=
"Region"
DefaultInsertValue=
"Beverages"
HeaderStyle-Width=
"100px"
UniqueName=
"Region"
DataField=
"Region"
>
<ItemTemplate>
<%# Eval(
"Region"
) %>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox ID=
"radComboBox"
RenderMode=
"Lightweight"
DropDownAutoWidth=
"Enabled"
runat=
"server"
AutoPostBack=
"false"
EnableLoadOnDemand=
"true"
DataValueField=
"RegionId"
DataTextField=
"RegionDesc"
DataSourceID=
"SqlDataSource2"
CheckBoxes=
"false"
>
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridButtonColumn ConfirmText=
"Delete this product?"
ConfirmDialogType=
"RadWindow"
ConfirmTitle=
"Delete"
HeaderText=
"Delete"
HeaderStyle-Width=
"50px"
CommandName=
"Delete"
Text=
"Delete"
UniqueName=
"DeleteColumn"
>
</telerik:GridButtonColumn>
</Columns>
</MasterTableView>
<ClientSettings AllowKeyboardNavigation=
"true"
></ClientSettings>
</telerik:RadGrid>
</div>
<asp:SqlDataSource ID=
"SqlDataSource1"
runat=
"server"
ConnectionString=
"Data Source=HGT-LAP-085;Initial Catalog=TexasHealthQA;UID=sa;Password=Hallmark123"
DeleteCommand=
"DELETE FROM [GlAccountMaintenanceConfig] WHERE [GLAccountMaintenanceId] = @GLAccountMaintenanceId"
InsertCommand=
"INSERT INTO [GlAccountMaintenanceConfig] ([Region]) VALUES (@Region)"
SelectCommand=
"SELECT GLAccountMaintenanceId,Region FROM [GlAccountMaintenanceConfig]"
UpdateCommand=
"UPDATE [GlAccountMaintenanceConfig] SET [Region] = @Region WHERE [GLAccountMaintenanceId] = @GLAccountMaintenanceId"
>
<DeleteParameters>
<asp:Parameter Name=
"GLAccountMaintenanceId"
Type=
"Int32"
></asp:Parameter>
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name=
"Region"
Type=
"String"
></asp:Parameter>
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name=
"GLAccountMaintenanceId"
Type=
"Int32"
></asp:Parameter>
<asp:Parameter Name=
"Region"
Type=
"String"
></asp:Parameter>
</UpdateParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID=
"SqlDataSource2"
runat=
"server"
ConnectionString=
"Data Source=HGT-LAP-085;Initial Catalog=TexasHealthQA;UID=sa;Password=Hallmark123"
ProviderName=
"System.Data.SqlClient"
SelectCommand=
"SELECT [RegionId],[RegionDesc] FROM Region"
></asp:SqlDataSource>
protected
void
RadGrid_BatchEditCommand(
object
sender, GridBatchEditingEventArgs e)
{
foreach
(GridBatchEditingCommand command
in
e.Commands)
{
if
(command.Type == GridBatchEditingCommandType.Update)
{
Hashtable newValues = command.NewValues;
Hashtable oldValues = command.OldValues;
RadComboBox radcombo = RadGrid1.FindControl(RadGrid1.MasterTableView.ClientID +
"_Region"
).FindControl(
"radComboBox"
)
as
RadComboBox;
string
radcomboitems =
string
.Empty;
foreach
(var item
in
radcombo.CheckedItems)
{
radcomboitems = radcomboitems + item.Value +
","
;
}
}
}
}
Please look into this issue and help to me, I am new to Telerik.
Thank you in advance