Trying to implement server side click to anchor tag Below code is in .CS file(sharepoint 2007/c#)
lblDetails.Text += userCreds[i].UserInfoID + " - " + "[a href='#' runat ='server' onserverclick='LinkButton_Click ]+ userCreds[i].AccountName + "[/a] ";
public void LinkButton_Click(object sender, EventArgs e)
{}
when cliking on link it is not going to LinkButton_clicked menthod
Please help !!!
尝试使用如下所示的委托/事件处理程序挂接事件,而不是使用onserverclick
标记注入事件。
lblDetails.Click += new EventHandler(LinkButton_Click);
See if this works:
Add a button that will do the action normally eg btnLinkButton
Register the event handler:
btnLinkButton.Click += new EventHandler(LinkButton_Click);
Add an event to the label
lblDetails.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(btnLinkButton, null))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.