I have another issue, my other issue concerning esDataSource isn't resolved, this is just another issue.
I have two NEW projects. One is a website, second a class library (.NET 3.5) containing ES files.
In project 1 (the website .NET 3.5):
- Added references to EntitySpaces, specified Loader in Global.asax / web.config
- Added esDatasource to Tabs
- Added esDataSource to page -> selected /bin/EC.DLL from class library project for entities
- Selected my EntityCollection for the datasource and specified columns
- Added Gridview to page and selected Datasource
- Specified esSelect event of datasource
- When I build and run I get the following error: "Specified cast is not valid"
Here's the error and code:
[InvalidCastException: Specified cast is not valid.]
EntitySpaces.Web.esDataSourceView.FetchTotalRowCount(esDataSourceSelectEventArgs e) +682
EntitySpaces.Web.esDataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +393
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Control.EnsureChildControls() +87
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
Code:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="InspectionList._Default" %>
<%@ Register assembly="EntitySpaces.Web" namespace="EntitySpaces.Web" tagprefix="cc1" %>
<!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 runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<cc1:esDataSource ID="esDataSource1" runat="server" AutoPaging="True"
AutoSorting="True" />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="PnmAutoKey" DataSourceID="esDataSource1" AllowPaging="True"
AllowSorting="True" PageSize="30">
<Columns>
<asp:BoundField DataField="PnmAutoKey" HeaderText="PnmAutoKey" ReadOnly="True"
SortExpression="PnmAutoKey" />
<!--- REST OF THE COLUMNS ARE HERE --->
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
Code:
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub esDataSource1_esSelect(ByVal sender As Object, ByVal e As EntitySpaces.Web.esDataSourceSelectEventArgs) Handles esDataSource1.esSelect
Dim coll As New EC.BLL.PartsMasterCollection
coll.LoadAll()
e.Collection = coll
End Sub
End Class