Adding controls to Repeater during runtime

C

Charlie@CBFC

Hi:

I'm using the Repeater control to display one-to-many relationship between
Customer, Orders and Order Items. To do this, I bind the control to
Customer table to show customer data, then call a function from item
template to generate Order and Order items which are returned as a string
containing HTML markup tags.

Since the Orders and Order items tables are not bound to Repeater I can't
add a button template. The button will have as it's command argument the
invoice number I'll use to take some action. So- it appears I'll have to
add button programmitcally in function like so...

System.Web.UI.WebControls.Button btn = new Button();
btn.Text = "Finalize Order";
btn.CommandArgument = child["invoice_no"].ToString();
Repeater1.Controls.Add(btn);

this correctly adds control to page but doesn't get wired up to Repeater's
Item_Command. How do you get it wired to Item_Command event so I can catch
the command argument?

Thanks,
Charlie
 

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,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top