开发者

Anchor tag Onserverclick event

开发者 https://www.devze.com 2023-02-08 03:39 出处:网络
Trying to implement server side click to anchor tag Below code is i开发者_如何学编程n .CS file(sharepoint 2007/c#)

Trying to implement server side click to anchor tag Below code is i开发者_如何学编程n .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 !!!


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))


Try hooking up the event with a delegate/event handler like below instead of injecting it with the onserverclick tag.

lblDetails.Click += new EventHandler(LinkButton_Click);
0

精彩评论

暂无评论...
验证码 换一张
取 消