LinkButton Dynamic Control

Results 1 to 2 of 2

Thread: LinkButton Dynamic Control

  1. #1
    Join Date
    Dec 1969

    Default LinkButton Dynamic Control

    In My project, LinkButton control is created added to Placeholder dynamically. My problem is LinkButton Command event is not invoked, when it is clicked. It executes Page_Load event and exits, it doesn&#039;t goto the click event. Here is the code. If you know the problem, please let me know.<BR><BR><BR>protected System.Web.UI.WebControls.PlaceHolder Tabs;<BR><BR><BR>LinkButton btn = new LinkButton();<BR>btn.Text=tab;<BR>if (tab.Equals(currenttab)) <BR>{<BR> btn.BackColor=Color.LightGray;<BR> btn.ForeColor=Color.Black;<BR>}<BR>else<BR>{<BR> btn.BackColor=Color.LightSkyBlue;<BR> btn.ForeColor=Color.Black;<BR> <BR>}<BR> <BR>btn.CommandName="Section";<BR>btn.CommandArgum ent=tab;<BR>btn.Command += new System.Web.UI.WebControls.CommandEventHandler(this .OnLinkClick);<BR><BR>Tabs.Controls.Add(btn);<BR>< BR>private void OnLinkClick(object O, System.Web.UI.WebControls.CommandEventArgs E)<BR>{<BR>string currenttab = E.CommandArgument.ToString();<BR>Session["currenttab"]=currenttab;<BR>}<BR><BR>Thanks in advance<BR>Jaya

  2. #2
    Join Date
    Dec 1969

    Default RE: LinkButton Dynamic Control

    Do you have OnLinkClick on the OnClick event of the link button?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts