Below see the Server Error with the Stack Trace. I can't figure it out.
Also, please see the code for the project.
Can anyone please help thanks.
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="CustomerMaintenance.aspx.vb" Inherits="CustomerMaintenance" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<%--gridview display data retrieved from database--%>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataMember="DefaultView"
DataSourceID="SqlDataSource1" AllowPaging="True" AllowSorting="True"
DataKeyNames="CustomerID">
<RowStyle BackColor="White" ForeColor="Black" />
<%-- adding columns that is bound to the database--%>
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True"
SortExpression="Name" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State"
SortExpression="State" />
<asp:CommandField ButtonType="Button" SelectText="Select" ShowSelectButton="True" />
</Columns>
<%-- adding style to the pages--%>
<PagerStyle BackColor="Silver" ForeColor="Blue" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="Blue" ForeColor="White" />
<HeaderStyle BackColor="Silver" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="WhiteSmoke" ForeColor="Black" />
<%--end of gridview design--%>
</asp:GridView>
<%-- adding columns that is bound to the database--%> <%-- adding style to the pages--%>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TechSupportConnectionString %>"
SelectCommand="SELECT [Name], [City], [State] FROM [Customers]">
<%--close connection--%>
</asp:SqlDataSource>
</td>
<td class="style2" valign="top">
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataKeyNames="CustomerID" DataSourceID="SqlDataSource2" Height="50px"
Width="400px">
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<Fields>
<asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"
SortExpression="CustomerID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Address" HeaderText="Address"
SortExpression="Address" />
<asp:BoundField DataField="City" HeaderText="City"
SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State"
SortExpression="State" />
<asp:BoundField DataField="ZipCode" HeaderText="ZipCode"
SortExpression="ZipCode" />
<asp:BoundField DataField="Phone" HeaderText="Phone"
SortExpression="Phone" />
<asp:BoundField DataField="Email" HeaderText="Email"
SortExpression="Email" />
<asp:CommandField ButtonType="Button"
ShowDeleteButton="true"
ShowEditButton="true"
ShowInsertButton="true" />
</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:TechSupportConnectionString2 %>"
OldValuesParameterFormatString="original_{0}"
SelectCommand="SELECT * FROM [Customers]
WHERE ([CustomerID] = @CustomerID)"
DeleteCommand="DELETE FROM [Customers]
WHERE [CustomerID] = @original_CustomerID
AND [Name] = @original_Name
AND [Address] = @original_Address
AND [City] = @original_City
AND [State] = @original_State
AND [ZipCode] = @original_ZipCode
AND [Phone] = @original_Phone
AND [Email] = @original_Email"
InsertCommand="INSERT INTO [Customers]
([CustomerID], [Name], [Address], [City], [State], [ZipCode], [Phone], [Email])
VALUES (@CustomerID, @Name, @Address, @City, @State, @ZipCode, @Phone, @Email)"
UpdateCommand="UPDATE [Customers] SET [Name] = @Name,
[Address] = @Address,
[City] = @City,
[State] = @State,
[ZipCode] = @ZipCode,
[Phone] = @Phone,
[Email] = @Email
WHERE [CustomerID] = @original_CustomerID
AND [Name] = @original_Name
AND [Address] = @original_Address
AND [City] = @original_City
AND [State] = @original_State
AND [ZipCode] = @original_ZipCode
AND [Phone] = @original_Phone
AND [Email] = @original_Email">
<%--Selecting parameterss to select--%>
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="CustomerID"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<%--Delete Parameters--%>
<DeleteParameters>
<asp:Parameter Name="original_CustomerID" Type="String" />
<asp:Parameter Name="original_Name" Type="String" />
<asp:Parameter Name="original_Address" Type="String" />
<asp:Parameter Name="original_City" Type="String" />
<asp:Parameter Name="original_State" Type="String" />
<asp:Parameter Name="original_ZipCode" Type="String" />
<asp:Parameter Name="original_Phone" Type="String" />
<asp:Parameter Name="original_Email" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="original_CustomerID" Type="String" />
<asp:Parameter Name="original_Name" Type="String" />
<asp:Parameter Name="original_Address" Type="String" />
<asp:Parameter Name="original_City" Type="String" />
<asp:Parameter Name="original_State" Type="String" />
<asp:Parameter Name="original_ZipCode" Type="String" />
<asp:Parameter Name="original_Phone" Type="String" />
<asp:Parameter Name="original_Email" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="original_CustomerID" Type="String" />
<asp:Parameter Name="original_Name" Type="String" />
<asp:Parameter Name="original_Address" Type="String" />
<asp:Parameter Name="original_City" Type="String" />
<asp:Parameter Name="original_State" Type="String" />
<asp:Parameter Name="original_ZipCode" Type="String" />
<asp:Parameter Name="original_Phone" Type="String" />
<asp:Parameter Name="original_Email" Type="String" />
</InsertParameters>
<%--end of parameters--%>
</asp:SqlDataSource>
<br />
</td>
</tr>
</table>
Server Error in '/Unit 8' Application.
--------------------------------------------------------------------------------
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'CustomerID'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'CustomerID'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'CustomerID'.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +8660309
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +2178
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +57
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +14
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +114
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +31
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +44
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Control.PreRenderRecursiveInternal() +171
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842

New Topic/Question
Reply




MultiQuote





|