Problems binding to data grid.

Posts   
 
    
legos211
User
Posts: 11
Joined: 06-Dec-2004
# Posted on: 06-Dec-2004 03:37:03   

Hello,

I have been using LLBLGen on a rather large project with no problems for about 10 months. I just setup a new PC, it is an identically installation of the other development machine I use. On my other development machine as well as all of our other developers machines are project builds and executes perfectly. On this newly installed machine the project builds properly but it does not execute. We get all kinds of errors when binding to datagrids, there may be problems elsewhere but so far I haven't been able to get far enough to find them. Here is the error I am getting... I have seen this message a lot on different microsoft news groups but they are usually people trying to access properties that do not exist in an object, that is not the case here. My BusinessEntity class does contain and Accout property and VS.NET sees it when writing C# code in the IDE. Any help would be greatly appreciated. If this is not an LLBLGen error but you can point me in the proper direction that would be great as well. Thank You.

[HttpException (0x80004005): DataBinder.Eval: 'WSCSData.EntityClasses.BusinessEntity' does not contain a property with the name Account.] System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) System.Web.UI.DataBinder.Eval(Object container, String expression) ASP.Default_aspx.__DataBind__control143(Object sender, EventArgs e) in C:\repository\wsavings\WSCS\trunk\solution\WSCS\admin\accounts\Default.aspx:347 System.Web.UI.Control.OnDataBinding(EventArgs e) System.Web.UI.Control.DataBind() System.Web.UI.Control.DataBind() System.Web.UI.Control.DataBind() System.Web.UI.Control.DataBind() System.Web.UI.WebControls.DataGrid.CreateItem(Int32 itemIndex, Int32 dataSourceIndex, ListItemType itemType, Boolean dataBind, Object dataItem, DataGridColumn[] columns, TableRowCollection rows, PagedDataSource pagedDataSource) System.Web.UI.WebControls.DataGrid.CreateControlHierarchy(Boolean useDataSource) System.Web.UI.WebControls.BaseDataList.OnDataBinding(EventArgs e) System.Web.UI.WebControls.BaseDataList.DataBind() WSCS.admin.accounts.Default.BindData(Int32 accountTypeId) in C:\repository\wsavings\WSCS\trunk\solution\WSCS\admin\accounts\Default.aspx.cs:204 WSCS.admin.accounts.Default.Page_Load(Object sender, EventArgs e) in C:\repository\wsavings\WSCS\trunk\solution\WSCS\admin\accounts\Default.aspx.cs:69 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()

Craig Anderson Netstat Resources, LLC.

legos211
User
Posts: 11
Joined: 06-Dec-2004
# Posted on: 06-Dec-2004 04:57:23   

Update:

I have realized that I can make this code work on the new machine by switching from using something like...

<%#DataBinder.Eval(Container, "DataItem.Account.Id")%>

With something like...

<%#((WSCSData.EntityClasses.BusinessEntity)Container.DataItem).Account.Id%>

I don't have a problem using the second phrase but we have never had to do this before, I would really like to know what causes this problem. I am assuming it is a slightly different version of the .NET framework or something of that nature but so far I have not been able to find anything online. Any help would be greatly appreciated.

Craig Anderson Netstat Resources, LLC.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 06-Dec-2004 09:56:48   

DataBinder.Eval only works on datatables/datasets, use the casting construction (your second option in your posting) for typed databinding.

Frans Bouma | Lead developer LLBLGen Pro
legos211
User
Posts: 11
Joined: 06-Dec-2004
# Posted on: 07-Dec-2004 01:45:31   

Well, any idea why the first option works everywhere but on one machine?

Craig Anderson Netstat Resources, LLC.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 07-Dec-2004 10:10:02   

legos211 wrote:

Well, any idea why the first option works everywhere but on one machine?

Craig Anderson Netstat Resources, LLC.

Did you by any chance test that with a typedlist/view ? Sorry for this silly question, but I wondered about the same question for some time, until I discovered it was only working without casting for datasets/datatables....

Frans Bouma | Lead developer LLBLGen Pro
legos211
User
Posts: 11
Joined: 06-Dec-2004
# Posted on: 07-Dec-2004 18:18:52   

I have not tested it with a typedlist/view. I haven't really done anything because the projects code base is working everywhere but this one machine and I didn't want to start making changes/updates if it was just a mis-configuration/corruption of this one machine. This problem has driven me crazy simple_smile .

It's not really a big deal because it works everywhere else. However, if we should change the way we are doing things I will, it will just be a lot of code to go through. I cannot believe I am the only person who has evern seen this, which leads to to believe I should just try re-building the problem machine. I actually am putting together a new laptop for myself next week and will install our dev environment there and see what happens.

Craig Anderson Netstat Resources, LLC.

P.S. - We have been very happy with LLBLGen thus far. We are using it in a pretty large project and so far it has saved us a ton of time and been very reliable.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 08-Dec-2004 09:13:50   

legos211 wrote:

I have not tested it with a typedlist/view. I haven't really done anything because the projects code base is working everywhere but this one machine and I didn't want to start making changes/updates if it was just a mis-configuration/corruption of this one machine. This problem has driven me crazy simple_smile .

I can imagine simple_smile . I'm not aware of anyone else having this problem...

P.S. - We have been very happy with LLBLGen thus far. We are using it in a pretty large project and so far it has saved us a ton of time and been very reliable.

Thanks for this great feedback! smile

Frans Bouma | Lead developer LLBLGen Pro
legos211
User
Posts: 11
Joined: 06-Dec-2004
# Posted on: 20-Dec-2004 04:52:35   

Ok, this is a big problem for me now. It is happening on every new machine I deploy but not on our older machines that were setup in the spring/summer. It must have something to do with an update to the the .net framework or some other windows update. It's driving me crazy, if I cannot fix the problem I will have to go through the entire application and change all the datagrids that use the databinder.evel function.

Craig Anderson NSR Business Solutions

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 20-Dec-2004 09:41:30   

Please verify you use the same assembly you compiled from the generated code on the machine it works on and the machine it doesn't work on. It could be you use an older version of the code which for example doesn't have a property 'Account' which is present in newer versions of the generated code.

Frans Bouma | Lead developer LLBLGen Pro