开发者

Anchor tag Onserverclick event

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜