[thelist] ASP.NET: Passing the value of a link button
Casey Crookston
caseyc at IntelliSoftmn.com
Tue Aug 8 11:25:56 CDT 2006
CHRIS:
See my previous post - you don't use the Click event, you use the
Command event. This event allows you to specify a name for the command
and an argument, which is then available from your event handler. The
links I posted show you how to do this in VB, it should be trivial for
you to implement it. If you have any problems, call out.
CASEY:
I did look long and hard at your previous post - I was having trouble
getting it to work in VB. See Below:
CHRIS' ORIGINAL POST:
----------------------------------
for (int i = 65, i <= 90; ++i)
{
LinkButton lb = new LinkButton();
lb.Text = "&#" + i + "; ";
lb.CommandName = "alpha";
lb.CommandArgument = i;
lb.Command += new CommandEventHandler(AlphaCommand); <-- Could no
get this to work. Lb.command is not recognized.
plhAlpha.Controls.Add(lb);
}
----------------------------------
private void AlphaCommand(object sender, CommandEventArgs e) {
Response.Output.Write("Command {0} has argument {1}.",
e.CommandName, e.CommandArgument); }
----------------------------------
More information about the thelist
mailing list