ASP.NET 2.0: problem with CompositeDataboundControl and GetSampleDataSource

J

Jos

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
 
J

Jos

Jos said:
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

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

Jos
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top