Page Load error when caliing Stored procedure using LINQTOSQL

  • Thread starter Alex. O. Koranteng
  • Start date
A

Alex. O. Koranteng

I am using LINQTOSQL as my dataaccess technique. I have a button on a page
for which will load a page using the postbackurl property. I have defined the
namespace for my dbml file as NwindLinqSProcs. The stored procedures for this
application in the methods pane of the layout file for the dbml file. I am
getting error below for the click event of the button. Please see below for
the code and will appreciate any suggestions


<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="LinqCustomersSP.aspx.cs" Inherits="NwindWebSite.LinqCustomersSP"
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>LinqDataSource Binding with LINQ to SQL Data Access Layer (DAL)
with Stored Procedures (C#)</title>
</head>
<body>
<form id="frmMain" runat="server">
<div style="text-align:center">
<asp:Label ID="lblHeader" runat="server" Font-Bold="True"
Font-Names="Calibri"
Font-Size="14pt" Text="LinqDataSource Binding with LINQ to SQL
Data Access Layer (DAL) with Stored Procedures (C#)"
Width="100%" Height="24px" ForeColor="#507CD1"></asp:Label>
</div>
<div>
<asp:GridView ID="gvCustomers" runat="server" CellPadding="4"
Font-Names="Calibri" Font-Size="11pt" ForeColor="#333333"
GridLines="None"
Width="100%" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="CustomerID"
DataSourceID="ldsCustomers">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#EFF3FB" />
<columns>
<asp:commandfield ShowEditButton="True" ShowSelectButton="True">
</asp:commandfield>
<asp:boundfield DataField="CustomerID" HeaderText="CustomerID"
ReadOnly="True"
SortExpression="CustomerID"></asp:boundfield>
<asp:boundfield DataField="CompanyName" HeaderText="CompanyName"
SortExpression="CompanyName"></asp:boundfield>
<asp:boundfield DataField="ContactName" HeaderText="ContactName"
SortExpression="ContactName"></asp:boundfield>
<asp:boundfield DataField="ContactTitle"
HeaderText="ContactTitle"
SortExpression="ContactTitle"></asp:boundfield>
<asp:boundfield DataField="Address" HeaderText="Address"
SortExpression="Address"></asp:boundfield>
<asp:boundfield DataField="City" HeaderText="City"
SortExpression="City">
</asp:boundfield>
<asp:boundfield DataField="Region" HeaderText="Region"
SortExpression="Region">
</asp:boundfield>
<asp:boundfield DataField="PostalCode" HeaderText="PostalCode"
SortExpression="PostalCode"></asp:boundfield>
<asp:boundfield DataField="Country" HeaderText="Country"
SortExpression="Country"></asp:boundfield>
<asp:boundfield DataField="Phone" HeaderText="Phone"
SortExpression="Phone">
</asp:boundfield>
<asp:boundfield DataField="Fax" HeaderText="Fax"
SortExpression="Fax">
</asp:boundfield>
</columns>
<PagerStyle BackColor="#2461BF" ForeColor="White"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True"
ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</div>
<div style="text-align:center;vertical-align: middle;">
<asp:LinkButton ID="lbOrdersSP" runat="server" BorderColor="White"
BorderWidth="7px" Font-Names="Calibri" Font-Size="11pt"
PostBackUrl="~/LinqOrdersSP.aspx" Width="223px"
style="margin-left: 0px">Orders
(Stored Procedures)</asp:LinkButton>
<asp:Button ID="btnAddBogus" runat="server" Font-Names="Calibri"
Font-Size="11pt" onclick="btnAddBogus_Click" Text="Add BOGUS
Customer"
Width="155px" />
<asp:Button ID="btnDeleteBogus" runat="server" Font-Names="Calibri"
Font-Size="11pt" onclick="btnDeleteBogus_Click" Text="Drop BOGUS
Customer"
Width="160px" />
<asp:LinkButton ID="lbObjectDS" runat="server" BorderColor="White"
BorderWidth="7px" Font-Names="Calibri" Font-Size="11pt"
PostBackUrl="~/ObjectDataSource.aspx"
Width="150px">ObjectDataSource</asp:LinkButton>
</div>
<asp:LinqDataSource ID="ldsCustomers" runat="server"
ContextTypeName="NwindLinqSProcsCS.NorthwindDataContext"
EnableDelete="True"
EnableInsert="True" EnableUpdate="True" TableName="Customers">
</asp:LinqDataSource>
</form>
</body>
</html>


Could not load type 'NwindLinqSProcsCS.NorthwindDataContext'.
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: Could not load type
'NwindLinqSProcsCS.NorthwindDataContext'.

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): Could not load type
'NwindLinqSProcsCS.NorthwindDataContext'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean
throwOnError, Boolean ignoreCase) +8819397
System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +93
 
A

Allen Chen [MSFT]

Hi Alex,
[HttpException (0x80004005): Could not load type
'NwindLinqSProcsCS.NorthwindDataContext'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean
throwOnError, Boolean ignoreCase) +8819397
System.Web.UI.WebControls.LinqDataSourceView.get_ContextType() +93

Could you try to rebuild the entire solution to see if it works? Do you see
any error in the compile time? If it still doesn't work please send me a
demo that can reproduce this problem. My email is (e-mail address removed).
Please update here after sending the project in case I missed that email.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
A

Allen Chen [MSFT]

Hi Alex,
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.


Have you solved this issue?

Regards,
Allen Chen
Microsoft Online Support
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,056
Messages
2,570,439
Members
47,101
Latest member
DoloresHol

Latest Threads

Top