all groups > asp.net building controls > august 2005 >
You're in the

asp.net building controls

group:

ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource


ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource Jos
8/17/2005 12:00:00 AM
asp.net building controls:
I have a control derived from CompositeDataboundControl, which is working
fine at run time, but I can't get the control to draw itself at design time.

I have overridden the GetSampleDataSource method, so that my control
designer can provide dummy data.
The problem seems to be that the GetDesignTimeHtml method is called three
times when the control is refreshed in the designer.
The first time the GetSampleDataSource method will also be called correctly,
and all goes well.
But the second and third time, GetSampleDataSource is not called, and some
other sample data with column names such as "Databound Col0" is offered to
the control, which it can't handle (it expects columns with particular
names). I'm guessing that this is somehow caused by the DataSourceControl.

Also, when a property is changed in the property pane, and this causes the
control to rebind in the designer, GetSampleDataSource is not being called
either, and the control is stuck again with "Databound Col0" columns.

There is very little documentation on the net about this.
GetSampleDataSource only gets 4 hits on Google.
Does anybody know more about this problem?

Jos

Re: ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource Jos
8/17/2005 12:00:00 AM
[quoted text, click to view]

OK, I solved it by using GetDesignTimeDataSource instead of
GetSampleDataSource.

Jos


AddThis Social Bookmark Button