I have a RadGrid in a FormView. I bind to the FormView with an object datasource. The grid binds to a List that is a property of the object datasource object. The first time loading the page (in Edit Mode) which retrieves a record everything works fine and the grid binds to the List. When I hit Submit to save everything I get the error. We are running 2010.1.415.35
<telerik:RadGrid |
ID="RegGrid" |
runat="server" |
Skin="Windows7" |
BorderStyle="None" |
GridLines="None" |
Width="650px" |
PageSize="20" |
AllowFilteringByColumn="true" |
AllowSorting="True" |
ShowFooter="True" |
AllowPaging="True" |
AutoGenerateColumns="False" |
EnableLinqExpressions="false" |
AllowAutomaticInserts="false" |
AllowAutomaticUpdates="false" |
AllowAutomaticDeletes="false" |
OnItemCreated="RegGrid_ItemCreated" |
OnItemCommand="RegGrid_ItemCommand" |
OnItemDataBound="RegGrid_ItemDataBound" |
OnDeleteCommand="RegGrid_DeleteCommand" |
OnInsertCommand="RegGrid_InsertCommand" |
OnUpdateCommand="RegGrid_UpdateCommand" |
OnNeedDataSource="RegGrid_NeedDataSource"> |
<ClientSettings> |
<Selecting AllowRowSelect="false" /> |
</ClientSettings> |
<MasterTableView |
DataKeyNames="regRequest,item" |
EditMode="InPlace" |
AllowFilteringByColumn="True" |
ShowFooter="True" |
CommandItemDisplay="Top" |
InsertItemPageIndexAction="ShowItemOnCurrentPage" |
CommandItemSettings-AddNewRecordText="Add Package" |
ItemStyle-VerticalAlign="top" |
AlternatingItemStyle-VerticalAlign="top" |
HeaderStyle-HorizontalAlign="Center"> |
<Columns> |
<telerik:GridTemplateColumn AllowFiltering="false"> |
<ItemTemplate> |
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Edit">Edit</asp:LinkButton> |
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" OnClientClick="javascript:return confirm('Delete this Reg Item?')">Delete</asp:LinkButton> |
</ItemTemplate> |
<EditItemTemplate> |
<asp:LinkButton ID="LinkButton3" runat="server" Text='<%# ((GridItem)Container).OwnerTableView.IsItemInserted? "Insert" : "Update" %>' |
CommandName='<%# ((GridItem)Container).OwnerTableView.IsItemInserted? "PerformInsert" : "Update" %>'></asp:LinkButton> |
<asp:LinkButton ID="LinkButton4" runat="server" CommandName="Cancel">Cancel</asp:LinkButton> |
</EditItemTemplate> |
</telerik:GridTemplateColumn> |
<telerik:GridBoundColumn DataField="regRequest" Visible="false" /> |
<telerik:GridDropDownColumn UniqueName="ddcRegItems" DataField="item" ListTextField="name" ListValueField="item" |
DataSourceID="sqlRegRequestItem" HeaderText="Reg Item" DropDownControlType="DropDownList" EmptyListItemText="- Select A Package -" EmptyListItemValue="0" /> |
<telerik:GridBoundColumn DataField="quantity" HeaderText="Qty" DataFormatString="{0:n}" /> |
<telerik:GridBoundColumn DataField="price" HeaderText="Price" DataFormatString="{0:C}" ReadOnly="true" /> |
<telerik:GridCalculatedColumn HeaderText="Total (USD)" UniqueName="ExtendedPrice" |
DataType="System.Double" DataFields="quantity, price" Expression="{0}*{1}" FooterText="Total : " |
Aggregate="Sum" DataFormatString="{0:C}" /> |
</Columns> |
</MasterTableView> |
<PagerStyle Mode="NextPrevAndNumeric" /> |
</telerik:RadGrid> |
protected void RegGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
{ |
RIM.Event.Resources.Regcode.Request _request = (RIM.Event.Resources.Regcode.Request)(Session["Request"]); |
if (_request != null) |
{ |
// SELECT NON-DELETED ITEMS |
List<RegItem> _regitems = _request.regItems.FindAll(p => p.deleted != true); |
((RadGrid)source).DataSource = _regitems; |
} |
} |