ASP 2.0 databound controls and code behind

C

Charlie@CBFC

Hi:

The new databound controls (GridView, DetailsView, ect.) use declaritive
syntax (i.e, setup in HTML at design time). However, at times sql
statements and parameters may need to be derived at runtime. In ASP 1.0 we
could do this in code behind, but how do we do it in ASP 2.0? The examples
I see are setting up controls compeletly at design time.

Thanks,
Charlie
 
G

Guest

You can do whatever you want with a GridView at runtime, e.g.


GridView gv = new GridView();
gv.HeaderRow.Cells.Add(new TableCell());
gv.Width = 500;
gv.AllowSorting = true;
gv.DataSource = MyDataSet();
// ...etc
this.PlaceHolder1.Controls.Add(gv);
gv.DataBind();
 
G

Guest

Hi Peter,
Does setting the datasource like you said, don't you loose the ability to
use the builtin update and delete functionallity. I just rewote a page
because I did it this way and could not get the newvalues or oldvalues to
work. Just wondering. I'm still working on getting my page to commpletely
work with the update, but its coming along.
Michael
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top