I am using c#.net.
I am trying to create a LinkButton within the code-behind, when I debug my code I recieve no errors, however its not accessing the EventArg attached to the button, it does however refresh the page. What am I doing wrong?
LinkButton myLinkButton = new LinkButton();
myLinkButton.ID = appointment.appID.ToString();
myLinkButton.CommandArgument = appointment.appID.ToString();
myLinkButton.Command += new CommandEventHandler(ViewClick);
myLinkButton.CommandName = appointment.appID.ToString();
myLinkButton.Text = appointment.contactName
Used to style button
string divLook = "height:" + divHeight + "em";
Button is then added to a panel
Panel p = new Panel();
p.CssClass = "standardLink";
protected void ViewClick(object sender, CommandEventArgs e)
var appointmentId = Convert.ToInt32(e.CommandArgument);
Debug.Write("Are you even getting in here");
Thanks in advance for any help.
Everything looks legit. I would recommend viewing the source of the generated page and looking at the ID that the link button is getting. It may be duped on the page.