I get a DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'priority_id'. error message when I click the edit button on DataGrid. I am not quite sure what is going on. I am relatively new to this and followed the direction in my book but it still does not work. Below is my code. Any help would be appreciated.
<%@ Page Language="VB" MasterPageFile="~/masters/
leftnavbar
_maint_tas
ks.master"
AutoEventWireup="false" CodeFile="sub_priority_typ
es.aspx.vb
" Inherits="maint_sub_priori
ty_types" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphM
ain" Runat="Server">
<h4>Add Sub-Priority Type...</h4>
<asp:formview id="frmAddSubPriority" runat="server" datakeynames="id" datasourceid="srcSubPriori
ty" defaultmode="Insert">
<edititemtemplate>
id:
<asp:label id="idLabel1" runat="server" text='<%# Eval("id") %>'></asp:label><br />
desc:
<asp:textbox id="descTextBox" runat="server" text='<%# Bind("desc") %>'>
</asp:textbox><br />
priority_id:
<asp:textbox id="priority_idTextBox" runat="server" text='<%# Bind("priority_id") %>'>
</asp:textbox><br />
weight:
<asp:textbox id="weightTextBox" runat="server" text='<%# Bind("weight") %>'>
</asp:textbox><br />
<asp:linkbutton id="UpdateButton" runat="server" causesvalidation="True" commandname="Update"
text="Update">
</asp:linkbutton>
<asp:linkbutton id="UpdateCancelButton" runat="server" causesvalidation="False" commandname="Cancel"
text="Cancel">
</asp:linkbutton>
</edititemtemplate>
<insertitemtemplate>
desc:
<asp:textbox id="descTextBox" runat="server" text='<%# Bind("desc") %>'></asp:textbox><br />
priority_id:
<asp:textbox id="priority_idTextBox" runat="server" text='<%# Bind("priority_id") %>'></asp:textbox><br />
weight:
<asp:textbox id="weightTextBox" runat="server" text='<%# Bind("weight") %>'></asp:textbox><br />
<asp:linkbutton id="InsertButton" runat="server" causesvalidation="True" commandname="Insert"
text="Insert"></asp:linkbu
tton>
<asp:linkbutton id="InsertCancelButton" runat="server" causesvalidation="False" commandname="Cancel"
text="Cancel"></asp:linkbu
tton>
</insertitemtemplate>
<itemtemplate>
id:
<asp:label id="idLabel" runat="server" text='<%# Eval("id") %>'></asp:label><br />
desc:
<asp:label id="descLabel" runat="server" text='<%# Bind("desc") %>'></asp:label><br />
priority_id:
<asp:label id="priority_idLabel" runat="server" text='<%# Bind("priority_id") %>'></asp:label><br />
weight:
<asp:label id="weightLabel" runat="server" text='<%# Bind("weight") %>'></asp:label><br />
<asp:linkbutton id="EditButton" runat="server" causesvalidation="False" commandname="Edit"
text="Edit"></asp:linkbutt
on>
<asp:linkbutton id="DeleteButton" runat="server" causesvalidation="False" commandname="Delete"
text="Delete"></asp:linkbu
tton>
<asp:linkbutton id="NewButton" runat="server" causesvalidation="False" commandname="New"
text="New"></asp:linkbutto
n>
</itemtemplate>
</asp:formview>
<h4>Current Sub-Priority Types...</h4>
<asp:gridview id="grdSubPriorities" runat="server" allowsorting="True" autogeneratecolumns="False
" datasourceid="srcSubPriori
ty">
<columns>
<asp:commandfield showeditbutton="True" />
<asp:templatefield headertext="Description">
<itemtemplate><%# Eval("desc") %></itemtemplate>
<edititemtemplate>
<asp:textbox id="txtSubDesc" text='<%# Bind("desc") %>' runat="server"></asp:textb
ox>
</edititemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Weighting">
<itemtemplate><%# Eval("weight") %></itemtemplate>
<edititemtemplate>
<asp:textbox id="txtDesc" text='<%# Bind("weight") %>' runat="server"></asp:textb
ox>
</edititemtemplate>
</asp:templatefield>
<asp:templatefield headertext="Priority">
<itemtemplate><%#Eval("pri
ority")%><
/itemtempl
ate>
<edititemtemplate>
<asp:dropdownlist
id="ddlPriority"
datasourceid="srcPriority"
datatextfield="desc"
datavaluefield="id"
selectedvalue='<%#Bind("pr
iority_id"
) %>'
runat="server">
</asp:dropdownlist>
</edititemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
<asp:sqldatasource id="srcSubPriority" runat="server" conflictdetection="Compare
AllValues"
connectionstring="<%$ ConnectionStrings:conMaint
Tasks %>"
insertcommand="INSERT INTO [sub_priority] ([desc], [priority_id], [weight]) VALUES (@desc, @priority_id, @weight)"
oldvaluesparameterformatst
ring="orig
inal_{0}"
selectcommand="SELECT sub_priority.id, sub_priority.[desc], sub_priority.weight,
priority.[desc] AS priority FROM sub_priority
JOIN priority ON sub_priority.priority_id = priority.id"
updatecommand="UPDATE [sub_priority] SET [desc] = @desc, [priority_id] = @priority_id,
[weight] = @weight WHERE [id] = @id">
<updateparameters>
<asp:parameter name="id" type="Int32" />
<asp:parameter name="desc" type="String" />
<asp:parameter name="priority_id" type="Int32" />
<asp:parameter name="weight" type="Byte" />
</updateparameters>
<insertparameters>
<asp:parameter name="desc" type="String" />
<asp:parameter name="priority_id" type="Int32" />
<asp:parameter name="weight" type="Byte" />
</insertparameters>
</asp:sqldatasource>
<asp:sqldatasource
id="srcPriority"
runat="server"
connectionstring="<%$ ConnectionStrings:conMaint
Tasks %>"
selectcommand="SELECT [id], [desc] FROM [priority]">
</asp:sqldatasource>
</asp:Content>