linkbutton


LinkButton not accessing EventArg


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?
Button Code
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.Style.Add("linkStyle", divLook);
p.CssClass = "standardLink";
p.Controls.Add(myLinkButton);
dataCell.Controls.Add(p);
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.
Clare
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.

Related Links

How to set backcolor property of the linkbutton set to visible only if it is clicked?
hit enter key Link Button not working firefox
LinkButton not accessing EventArg

Categories

HOME
magento2
xcode
focus
seedstack
scroll
clone
google-search-console
polymer-2.x
msmq
twisted
reselect
maven-plugin
scheduled-tasks
bluemix-mobile-services
uislider
candlestick-chart
pdf.js
raima
unordered-multimap
background-color
tsung
social-networking
jsonresult
actframework
cucumber-junit
shapeless
markov-chains
data-uri
secure-coding
viewcontroller
distributed-caching
contactless-smartcard
oracle-bmcs
reverse-dns
nomad
nonlinear-functions
android-webservice
gtk#
sesame
mechanicalturk
livereload
svnserve
django-testing
callouts
oci
dojo-build
yii2-model
odp.net-managed
facebook-ios-sdk
jeditable
mnesia
teensy
apache-commons-digester
blank-line
gluon-desktop
netdatacontractserializer
karma-coverage
prism-4
mutators
debug-symbols
jcheckbox
microsoft-expression-web
zend-mail
multivariate-testing
treeline
csslint
prism.js
nosql-aggregation
windows-taskbar
insertonsubmit
itunes-sdk
handshake
gitx
getproperty
workflow-manager-1.x
image-scanner
monocross
n-queens
servercontrol
glassfish-esb
database-deadlocks
startupscript
azure-acs
fragment-identifier
ccl
ccnet-config
sscli
eai
motif
version-control-migration
twitter-feed
suggestbox

Resources

Encrypt Message