Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add buttons dynamically?

Status
Not open for further replies.

DixieFlatline

Programmer
Aug 2, 2000
57
CA
Hi,

I have placed a PlaceHolder on my aspx file and in one of my event handler ( a search handler ) dynamically add HyperLink, Label and Button controls dynamically to this PlaceHolder. However, I can't seem to get the event handling for the buttons to hook up properly. Right now, I generate a button for every record I have and use the record ID as the control ID with all buttons pointing to the same event handler method call addToFavorite(). In every button I set
( myButton.ID=report.ID and myButton.CommandName="addToFavorite" )

is this the same as setting OnClick="addToFavorite" ?
and if I can get the event handling to work, how should I cast the sender object so that I can get the ID back (the one I set as report.ID ).

Need help!!

Thanks,
Dix
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top