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

No InsertItem Template in Grid

1 Answer 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Grey
Top achievements
Rank 1
Grey asked on 16 Jul 2010, 08:52 AM
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
<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>


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 ?


1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 21 Jul 2010, 10:56 AM
Hello Grey,

Please check out the following documentation article which elaborates on the known reasons for error messages:
http://www.telerik.com/help/aspnet-ajax/grderrormessages.html ('DropDownList' has a SelectedValue which is invalid because it does not exist in the list of items section)

Additionally I am sending you a simple example which demonstrates how to achieve the desired functionality. Please check it out and let me know if it helps you.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Grey
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or