How do I add a linkbutton to a gridview at runtime

Joined
Apr 30, 2009
Messages
1
Reaction score
0
I create a gridview at runtime and would like to add a linkbutton to each row of the gridview also at runtime but, I can't figure out how to do this. The code that doesn't work is below. The linkbutton will be used to launch a modal popup window that will allow the user to edit the selected gridview row in a formview type manner.

LinkButton lb = new LinkButton();
lb.ID = "lnkEditProduct";
lb.Text = "Edit Item";
lb.CommandArgument = "<%# Bind('itemID') %>";
lb.CommandName = "EditProduct";
lb.CausesValidation = false;
gvResults.Columns.Add(lb);

Thank you!
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top