Need to dynamically add <ASP:Button> controls to web user control w.in page

F

FredZimmerman

How do I dynamically generate <ASP:button> controls for a repeating
recordset (using reader with while loop).

Each row would have ASP:Button and CommandName="sameFunctionForAll()"
CommandArgument=reader["ProductID"].ToString()

I'm not at all sure how to tackle this.

I have page that contains embedded .ASCX. The buttons would be
displayed within the embedded web user control.

Thanks.

F.Z.
 
N

Nathan Sokalski

Correct me if I'm wrong, but why are you not using a Repeater or DataList
control? Using these would allow you to use databinding rather than a while
loop. Using databinding makes it easier to do layout and usually requires
less code. Perhaps if I could see your code I might be able to be more
specific about what I would suggest.
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top