Hi,
I've customized a RadGrid so that my Category field can be selected from a dropdownlist.
I've done this via the following code in the 'EditItem' template for my ProductCategoryName Template column
As shown below
My problem is that it appears that the RadGRid does not have an <InsertItemTemplate> and instead just uses whetever is in the
<EditItem> Template when one is in in Insert mode.
This, naturally means that I get the following error...
'DropDownList1' has a SelectedValue which is invalid
because it does not exist in the list of items.
Would anyone be able to provide me with a solution for this problem ?
I've customized a RadGrid so that my Category field can be selected from a dropdownlist.
I've done this via the following code in the 'EditItem' template for my ProductCategoryName Template column
As shown below
<telerik:GridTemplateColumn DataField="ProductCategoryName"
DefaultInsertValue="" HeaderText="Category"
SortExpression="ProductCategoryName" UniqueName="ProductCategoryName">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSourceCategories" DataTextField="CategoryName" DataValueField="CategoryName" SelectedValue='<%# Bind("ProductCategoryName") %>'>
</asp:DropDownList>
</EditItemTemplate>
DefaultInsertValue="" HeaderText="Category"
SortExpression="ProductCategoryName" UniqueName="ProductCategoryName">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSourceCategories" DataTextField="CategoryName" DataValueField="CategoryName" SelectedValue='<%# Bind("ProductCategoryName") %>'>
</asp:DropDownList>
</EditItemTemplate>
My problem is that it appears that the RadGRid does not have an <InsertItemTemplate> and instead just uses whetever is in the
<EditItem> Template when one is in in Insert mode.
This, naturally means that I get the following error...
'DropDownList1' has a SelectedValue which is invalid
because it does not exist in the list of items.
Parameter name: value
Would anyone be able to provide me with a solution for this problem ?