Hello Sir, I am Using Combobox in RadGrid Edit Tempate.
Code is Given Below.
I want combobox for insert and set value from codebehind.
And SelecetedValue is not woking in edittemplate.
Please Give me proper solution.
---- ASPX Code ---
<telerik:RadGrid ID="gridPostCode" runat="server" Width="96%" GridLines="None" AutoGenerateColumns="False"
PageSize="10" AllowSorting="True" AllowPaging="True" OnUpdateCommand="gridPostCode_UpdateCommand"
OnNeedDataSource="gridPostCode_NeedDataSource" ShowStatusBar="true" OnInsertCommand="gridPostCode_InsertCommand"
OnDeleteCommand="gridPostCode_DeleteCommand"
onitemcommand="gridPostCode_ItemCommand">
<MasterTableView DataKeyNames="Id" Width="100%" CommandItemDisplay="Top" EditMode="InPlace">
<Columns>
<telerik:GridBoundColumn UniqueName="Id" HeaderText="Id" DataField="Id" ReadOnly="true" />
<telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Product Name"
SortExpression="Product Name">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem,"ProductId")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox OnItemsRequested="cmbProducts_ItemsRequested" EnableLoadOnDemand="True"
ID="cmbProducts" runat="server" Height="140px" Width="150px" >
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/Images/edit-icon.png"
UpdateImageUrl="~/Images/edit-icon.png" UniqueName="EditCommandColumn" HeaderText="Modify"
HeaderStyle-HorizontalAlign="Center" CancelImageUrl="~/Images/delete-icon.png">
<ItemStyle Width="50px" HorizontalAlign="Center" />
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
-- CS Code--
protected void gridPostCode_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem item = e.Item as GridEditableItem;
RadComboBox ddl = (RadComboBox)item.FindControl("cmbProducts");
}
}
Thanks.
Kishor Dalwadi
Code is Given Below.
I want combobox for insert and set value from codebehind.
And SelecetedValue is not woking in edittemplate.
Please Give me proper solution.
---- ASPX Code ---
<telerik:RadGrid ID="gridPostCode" runat="server" Width="96%" GridLines="None" AutoGenerateColumns="False"
PageSize="10" AllowSorting="True" AllowPaging="True" OnUpdateCommand="gridPostCode_UpdateCommand"
OnNeedDataSource="gridPostCode_NeedDataSource" ShowStatusBar="true" OnInsertCommand="gridPostCode_InsertCommand"
OnDeleteCommand="gridPostCode_DeleteCommand"
onitemcommand="gridPostCode_ItemCommand">
<MasterTableView DataKeyNames="Id" Width="100%" CommandItemDisplay="Top" EditMode="InPlace">
<Columns>
<telerik:GridBoundColumn UniqueName="Id" HeaderText="Id" DataField="Id" ReadOnly="true" />
<telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Product Name"
SortExpression="Product Name">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem,"ProductId")%>
</ItemTemplate>
<EditItemTemplate>
<telerik:RadComboBox OnItemsRequested="cmbProducts_ItemsRequested" EnableLoadOnDemand="True"
ID="cmbProducts" runat="server" Height="140px" Width="150px" >
</telerik:RadComboBox>
</EditItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/Images/edit-icon.png"
UpdateImageUrl="~/Images/edit-icon.png" UniqueName="EditCommandColumn" HeaderText="Modify"
HeaderStyle-HorizontalAlign="Center" CancelImageUrl="~/Images/delete-icon.png">
<ItemStyle Width="50px" HorizontalAlign="Center" />
</telerik:GridEditCommandColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
-- CS Code--
protected void gridPostCode_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem item = e.Item as GridEditableItem;
RadComboBox ddl = (RadComboBox)item.FindControl("cmbProducts");
}
}
Thanks.
Kishor Dalwadi