ReadOnlyRoot and CslaDataSource - Compatible ??

ReadOnlyRoot and CslaDataSource - Compatible ??

Old forum URL: forums.lhotka.net/forums/t/9035.aspx


tsaltd posted on Friday, June 04, 2010

Can't figure out why I am getting "Error Rendering the Control" "DetailsView1did not have any properties or attributes from which to generate fields."  Ensure that your data source has content.

Using 3.8.3.0 for ASP.Net WebForm.

Haven't tried it with any other BO types.

Thx,

Steve

 

RockfordLhotka replied on Friday, June 04, 2010

Have you put a breakpoint in your SelectObject event handler in the code-behind the page to see if the data portal call is successful and to ensure you are properly setting e.BusinessObject?

tsaltd replied on Monday, June 07, 2010

That event is not firing ....

Is there something in the Read Only BO itself that the CSLADataSource control needs to fire the SelectObject event ???

I don't see anything in the PageLoad example for ... for example RolesEdit that would cause the event to fire .. tho I have not set up the new ProjectTracker to step through the debugger myself.

 

RockfordLhotka replied on Monday, June 07, 2010

The event is raised when data binding requests data. It sounds like your web page code or HTML is not set up correctly for data binding.

A data source control only retrieves data when requested by data binding. Data binding only requests data when a UI control tries to bind to data. In many cases you need to actually call the bind method on the UI control in your page load event.

I must confess that I haven't done any web forms coding for a couple years, so my memory is pretty rusty - but look at the page load events in ProjectTracker (or any other data bound web app on the planet) to get an idea how the binding is triggered.

tsaltd replied on Monday, June 07, 2010

thanks Rocky ...

But I can't use the wizard to provide metatadata to set control attributes because of the Design Time issue.

"Can't figure out why I am getting:

 "Error Rendering the Control" "DetailsView1did not have any properties or attributes from which to generate fields."  Ensure that your data source has content.

Could the fact that I am using linq for entities to populate the BO's make a difference ??

 

RockfordLhotka replied on Monday, June 07, 2010

At least one data binding wizard in web forms doesn't work - due to an issue with VS that I've never been able to resolve. That's a well-known issue with the CslaDataSource control, and the answer is to put the data source control on the page by dragging it from the toolbox, and to then drag your UI control (datagrid, detailview, etc), and then bind the UI control to the CslaDataSource control.

An alternative is to use the wizard, but then to close and re-open the web forms designer. Reloading the designer fixes the VS issue and allows the controls to work as expected.

tsaltd replied on Monday, June 07, 2010

I may not have full trust on the machine that I'm using .... that could cause the problem, no ?

I can instantiate the BO by "new-ing it up" ... but sure could use the binding support.

Steve

 

tsaltd replied on Tuesday, June 08, 2010

Sure enough ... A details view *does* consume the data source when I run the app in VS08 on my personal machine ... but this "corporate developer machine" won't do the trick.

The Web.Config seems to indicate that I have full trust .. so what else might I look for or have the "IT Governance" police take a look at ????

thanks,

Steve

 

tsaltd replied on Tuesday, June 08, 2010

Ok ... back on my "dev box" at client ...

I guess this is what you meant, Rocky ....

That fixes the problem on the developer workstation ... ( a problem that does not occur on my personal machine )

RockfordLhotka replied on Tuesday, June 08, 2010

Yeah, that's what I was talking about.

I spent many, many hours trying to resolve that issue, with no success. I even bent the ear of several Microsoft people who worked on the designer interactions to no avail. It is a tough issue - the wizard seems to load the controls into a separate appdomain or context from the rest of the page designer, which totally conflicts with retreiving metadata using reflection (which is what CslaDataSource does to get the shape of your business object).

Since there's a workaround, I just documented it and moved on - hoping a subsequent version of VS would resolve the issue. But that hasn't happened...

Fortunately ASP.NET MVC doesn't have this issue, so now I'm sitting back waiting to see how much longer web forms remains relevant Smile

tsaltd replied on Wednesday, June 09, 2010

OK ... I'll close this out now ... but this morning after monkeying around with the web form designer those nasty "Error Creating Control" messages showed up again .. but the app runs and compiles ...

I'll see if I can get management to OK looking at going with MVC .....

Thanks again RL ...

Steve

 

Copyright (c) Marimer LLC