asp.net - System.Data.DataRowView' does not contain a property with the name 'ID' -


i've been having error asp.net. , seems on going. fix 1 thing leads error. had previous problem asked on here: issue inserts , updates. in top answer, told numerous things fix code; however, after inserted "datakeynames="id"" told error... have no idea why

now note in gridview, have "datakeynames="id", linked <asp:boundfield datafield="id" visible="false" /> here stack trace:

[httpexception (0x80004005): databinding: 'system.data.datarowview' not contain property name 'id'.]    system.web.ui.databinder.getpropertyvalue(object container, string propname) +9502089    system.web.ui.webcontrols.gridview.createchildcontrols(ienumerable datasource, boolean databinding) +3140    system.web.ui.webcontrols.compositedataboundcontrol.performdatabinding(ienumerable data) +67    system.web.ui.webcontrols.gridview.performdatabinding(ienumerable data) +14    system.web.ui.webcontrols.databoundcontrol.ondatasourceviewselectcallback(ienumerable data) +123    system.web.ui.datasourceview.select(datasourceselectarguments arguments, datasourceviewselectcallback callback) +33    system.web.ui.webcontrols.databoundcontrol.performselect() +138    system.web.ui.webcontrols.basedataboundcontrol.databind() +30    system.web.ui.webcontrols.gridview.databind() +4    system.web.ui.webcontrols.basedataboundcontrol.ensuredatabound() +105    system.web.ui.webcontrols.compositedataboundcontrol.createchildcontrols() +75    system.web.ui.control.ensurechildcontrols() +83    system.web.ui.control.prerenderrecursiveinternal() +42    system.web.ui.control.prerenderrecursiveinternal() +168    system.web.ui.control.prerenderrecursiveinternal() +168    system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint) +974 

my asp.net:

 <%@ page language="c#" autoeventwireup="true" codefile="medicaloffice.aspx.cs" inherits="medicaloffice" %>      <!doctype html>      <html xmlns="http://www.w3.org/1999/xhtml">     <head runat="server">         <title></title>          <link href="stylesheet.css" rel="stylesheet" />     </head>     <body>         <form id="form1" runat="server">         <div>         <h1>maintain patients<asp:sqldatasource id="sddoctorlist" runat="server" connectionstring="<%$ connectionstrings:medicalofficeconnectionstring %>" selectcommand="uspdoctorlist" selectcommandtype="storedprocedure"></asp:sqldatasource>             <asp:sqldatasource id="sdpatient" runat="server" connectionstring="<%$ connectionstrings:medicalofficeconnectionstring %>" deletecommand="usp_patientdelete" deletecommandtype="storedprocedure" insertcommand="usppatientinsert" insertcommandtype="storedprocedure" selectcommand="usppatientselectbyidorselectall" selectcommandtype="storedprocedure" updatecommand="usppatientupdate" updatecommandtype="storedprocedure">                 <deleteparameters>                     <asp:parameter name="id" type="int32" />                 </deleteparameters>                 <insertparameters>                     <asp:parameter name="ohip" type="string" />                     <asp:parameter name="firstname" type="string" />                     <asp:parameter name="lastname" type="string" />                     <asp:parameter dbtype="date" name="dob" />                     <asp:parameter name="visitsperyear" type="int32" />                     <asp:parameter name="doctorid" type="int32" />                 </insertparameters>                 <selectparameters>                     <asp:controlparameter controlid="dropdownlist1" defaultvalue="0" name="doctorid" propertyname="selectedvalue" type="int32" />                 </selectparameters>                 <updateparameters>                     <asp:parameter name="id" type="int32" />                     <asp:parameter name="ohip" type="string" />                     <asp:parameter name="firstname" type="string" />                     <asp:parameter name="lastname" type="string" />                     <asp:parameter dbtype="date" name="dob" />                     <asp:parameter name="visitsperyear" type="int32" />                     <asp:parameter name="doctorid" type="int32" />                 </updateparameters>             </asp:sqldatasource>             </h1>             <p>select patient doctor:<asp:dropdownlist id="dropdownlist1" runat="server" autopostback="true" datasourceid="sddoctorlist" datatextfield="doctor" datavaluefield="id" appenddatabounditems="true">                 <asp:listitem value="0">all doctors</asp:listitem>                 </asp:dropdownlist>             <asp:gridview id="gridview1" runat="server" allowsorting="true" autogeneratecolumns="false" backcolor="white" bordercolor="#336666" borderstyle="double" borderwidth="3px" cellpadding="4" datasourceid="sdpatient" gridlines="horizontal" datakeynames="id">                     <columns>                         <asp:commandfield showdeletebutton="true" showeditbutton="true" />                          <asp:boundfield datafield="id" visible="false" />                          <asp:templatefield headertext="ohip" sortexpression="ohip">                             <edititemtemplate>                                 <asp:textbox id="textbox1" runat="server" text='<%# bind("ohip") %>'></asp:textbox>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label1" runat="server" text='<%# bind("ohip") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="first name" sortexpression="firstname">                             <edititemtemplate>                                 <asp:textbox id="textbox2" runat="server" text='<%# bind("firstname") %>'></asp:textbox>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label2" runat="server" text='<%# bind("firstname") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="last name" sortexpression="lastname">                             <edititemtemplate>                                 <asp:textbox id="textbox3" runat="server" text='<%# bind("lastname") %>'></asp:textbox>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label3" runat="server" text='<%# bind("lastname") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="dob" sortexpression="dob">                             <edititemtemplate>                                 <asp:textbox id="textbox4" runat="server" text='<%# bind("dob") %>'></asp:textbox>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label4" runat="server" text='<%# bind("dob") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="visits per year" sortexpression="visitsperyear">                             <edititemtemplate>                                 <asp:textbox id="textbox5" runat="server" text='<%# bind("visitsperyear") %>'></asp:textbox>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label5" runat="server" text='<%# bind("visitsperyear") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                         <asp:templatefield headertext="doctor" sortexpression="doctor">                             <edititemtemplate>                                 <asp:dropdownlist id="dropdownlist2" runat="server" datasourceid="sddoctorlist" datatextfield="doctor" datavaluefield="id" selectedvalue='<%# bind("doctorid") %>' >                                 </asp:dropdownlist>                             </edititemtemplate>                             <itemtemplate>                                 <asp:label id="label6" runat="server" text='<%# bind("doctor") %>'></asp:label>                             </itemtemplate>                         </asp:templatefield>                     </columns>                     <footerstyle backcolor="white" forecolor="#333333" />                     <headerstyle backcolor="#336666" font-bold="true" forecolor="white" />                     <pagerstyle backcolor="#336666" forecolor="white" horizontalalign="center" />                     <rowstyle backcolor="white" forecolor="#333333" />                     <selectedrowstyle backcolor="#339966" font-bold="true" forecolor="white" />                     <sortedascendingcellstyle backcolor="#f7f7f7" />                     <sortedascendingheaderstyle backcolor="#487575" />                     <sorteddescendingcellstyle backcolor="#e5e5e5" />                     <sorteddescendingheaderstyle backcolor="#275353" />                 </asp:gridview> 


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -