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

GridDropDownColumn error when using AllowAutomaticLoadOnDemand="true"

3 Answers 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Josh
Top achievements
Rank 1
Josh asked on 09 Mar 2015, 03:09 PM
I reviewed this example: http://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/column-types/defaultcs.aspx and cannot seem to replicate this in my application.

                <telerik:GridDropDownColumn DataField="Item_Id" DataType="System.Int32" FilterControlAltText="Filter Item_Id column" HeaderText="Item"  UniqueName="Item_Id" AutoPostBackOnFilter="true" DataSourceID="EntityDataSourceItem" ListValueField="Id"  ListTextField="Model" AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10" SortExpression="Item_Id" EmptyListItemText="Select" AllowAutomaticLoadOnDemand="true" DropDownControlType="RadComboBox" >
                </telerik:GridDropDownColumn>
 
<asp:EntityDataSource ID="EntityDataSourceItem" runat="server" ConnectionString="name=autocalEntities" DefaultContainerName="autocalEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="items"></asp:EntityDataSource>

Everything populates correctly on load but when I attempt to edit and retrieve a filtered list from the gridview i get the object reference not set to an instance of an object exception. Any idea what I am missing? 

Thanks,
Josh

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 12 Mar 2015, 09:03 AM
Hi Josh,

Can you please share the whole RadGrid markup as well as the related code behind, so that we can see the full code and do our best to isolate the root cause of the issue?

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Josh
Top achievements
Rank 1
answered on 13 Mar 2015, 12:13 AM
Certainly,

Here is the mark up attached. I have nothing going on in the code behind. So that shouldn't be necessary. Also I attached a screen shot of exactly what I mean. This only happens when I put the grid in edit mode. 

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="EntityDataSourceAsset" GroupPanelPosition="Top" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AutoGenerateEditColumn="True">
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="Id" DataSourceID="EntityDataSourceAsset">
                <Columns>
                    <telerik:GridBoundColumn DataField="Id" DataType="System.Int32" FilterControlAltText="Filter Id column" HeaderText="Id" ReadOnly="True" SortExpression="Id" UniqueName="Id">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CustAsset" FilterControlAltText="Filter CustAsset column" HeaderText="CustAsset" SortExpression="CustAsset" UniqueName="CustAsset">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Customer_Id" DataType="System.Int32" FilterControlAltText="Filter Customer_Id column" HeaderText="Customer_Id" SortExpression="Customer_Id" UniqueName="Customer_Id">
                    </telerik:GridBoundColumn>
                    <telerik:GridDropDownColumn  DataField="Item_Id" ListTextField="MakeModel" ListValueField="Id" DataSourceID="EntityDataSourceMakeModel" AllowAutomaticLoadOnDemand="true" DataType="System.Int32" FilterControlAltText="Filter MakeModel column" HeaderText="Item" SortExpression="MakeModel" UniqueName="Item_Id">
                    </telerik:GridDropDownColumn>
                    <telerik:GridBoundColumn DataField="DateCreated" DataType="System.DateTime" FilterControlAltText="Filter DateCreated column" HeaderText="DateCreated" SortExpression="DateCreated" UniqueName="DateCreated">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Serial_Number" FilterControlAltText="Filter Serial_Number column" HeaderText="Serial_Number" SortExpression="Serial_Number" UniqueName="Serial_Number">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CycleLength" DataType="System.Int32" FilterControlAltText="Filter CycleLength column" HeaderText="CycleLength" SortExpression="CycleLength" UniqueName="CycleLength">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LastCalDate" DataType="System.DateTime" FilterControlAltText="Filter LastCalDate column" HeaderText="LastCalDate" SortExpression="LastCalDate" UniqueName="LastCalDate">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="CalDueDate" DataType="System.DateTime" FilterControlAltText="Filter CalDueDate column" HeaderText="CalDueDate" SortExpression="CalDueDate" UniqueName="CalDueDate">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
                    </telerik:GridBoundColumn>
                    <telerik:GridCheckBoxColumn DataField="Standard" DataType="System.Boolean" FilterControlAltText="Filter Standard column" HeaderText="Standard" SortExpression="Standard" UniqueName="Standard">
                    </telerik:GridCheckBoxColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
        <asp:EntityDataSource ID="EntityDataSourceAsset" runat="server" ConnectionString="name=autocalEntities" DefaultContainerName="autocalEntities" EnableDelete="True" EnableFlattening="False" EnableInsert="True" EnableUpdate="True" EntitySetName="assets"></asp:EntityDataSource>
        <asp:EntityDataSource ID="EntityDataSourceMakeModel" runat="server" ConnectionString="name=autocalEntities" DefaultContainerName="autocalEntities" EnableFlattening="False" EntitySetName="makeandmodels"></asp:EntityDataSource>
0
Maria Ilieva
Telerik team
answered on 17 Mar 2015, 12:51 PM
Hello Josh,


Can you please try to set the same filed as "DataField" and "ListValueField" like this:

<telerik:GridDropDownColumn  DataField="Item_Id" ListTextField="MakeModel" ListValueField="Item_Id" DataSourceID="EntityDataSourceMakeModel" AllowAutomaticLoadOnDemand="true" DataType="System.Int32" FilterControlAltText="Filter MakeModel column" HeaderText="Item" SortExpression="MakeModel" UniqueName="Item_Id">
</telerik:GridDropDownColumn>

 and see if this makes any difference.



Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Josh
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Josh
Top achievements
Rank 1
Share this question
or