entity framework - GridView binding with custom property in EntityObject derived class fails in ASP.NET -
i've entity framework layer , i've extended class layer. code follows:
public partial class featuremaster : entityobject { public string parentfeaturename { { return (from r in global.dc.featuremasters r.featureid == featureparentid select r).singleordefault().featurename; } set { featureparentid = (from r in global.dc.featuremasters r.featurename == value select r).singleordefault().featureid; reportpropertychanged(("parentfeaturename")); reportpropertychanged(("featureparentid")); } } } now wish use same in asp.net page. code asp.net page is:
<%@ page title="" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codebehind="listfeaturemaster.aspx.cs" inherits="backend.listfeaturemaster" %> <asp:content id="content1" contentplaceholderid="head" runat="server"> </asp:content> <asp:content id="content2" contentplaceholderid="cpmain" runat="server"> <asp:gridview id="grdrecords" runat="server" allowpaging="true" allowsorting="true" autogeneratecolumns="false" datakeynames="featureid" datasourceid="entitydatasource1"> <columns> <asp:commandfield showdeletebutton="true" showeditbutton="true" /> <asp:boundfield datafield="featureid" headertext="featureid" readonly="true" sortexpression="featureid" /> <asp:boundfield datafield="featurename" headertext="featurename" sortexpression="featurename" /> <asp:boundfield datafield="featureparentid" headertext="featureparentid" sortexpression="featureparentid" /> <asp:boundfield datafield="featuredescription" headertext="featuredescription" sortexpression="featuredescription" /> <asp:templatefield headertext="parentfeaturename" sortexpression="parentfeaturename"> <edititemtemplate> <asp:dropdownlist id="dropdownlist1" runat="server" datasourceid="entitydatasource1" appenddatabounditems="true" datatextfield="parentfeaturename" datavaluefield="parentfeaturename" selectedvalue='<%# bind("parentfeaturename") %>'> </asp:dropdownlist> </edititemtemplate> <itemtemplate> <asp:label id="label1" runat="server" text='<%# eval("parentfeaturename") %>'></asp:label> </itemtemplate> </asp:templatefield> </columns> </asp:gridview> <asp:entitydatasource id="entitydatasource1" runat="server" connectionstring="name=backendentities" defaultcontainername="backendentities" enableflattening="false" entitysetname="featuremasters" entitytypefilter="featuremaster" enabledelete="true" enableupdate="true"> </asp:entitydatasource> <asp:entitydatasource id="entitydatasource2" runat="server" connectionstring="name=backendentities" defaultcontainername="backendentities" enableflattening="false" entitysetname="featuremasters" entitytypefilter="featuremaster" enabledelete="true" enableupdate="true"> </asp:entitydatasource> </asp:content> the trouble when execute code, works on first load , navigation, when try update record, error. please me resolve same.
error message says:
a property named 'parentfeaturename' not found on entity during insert, update, or delete operation. check ensure properties specified binding expressions available data source.
i think problem don't attach custom property entity, , save it. can have adding customer property entity class
hope helps.
Comments
Post a Comment