i have set the following code to disable the click of link button btn.Attributes["OnClick"] = "return false;"; its working... but i want to make it appear as a label.
Well, you can accomplish this quite easily by using code behind. Double click the link and have an identical control called lblLink with the same text. Set its visibility to false on page load. When you click the link (lnkMyLink for example sake) you reverse
the visibility:
If by "appear as a label" you mean remove the underline, you can use the CSS style: style="text-decoration:none", or add it in code via the Style property.
neo-etj
Member
25 Points
24 Posts
disable a link button
Feb 17, 2011 12:08 PM|LINK
Trivandrum
Kerala
India
bbcompent1
All-Star
33865 Points
8772 Posts
Moderator
Re: disable a link button
Feb 17, 2011 12:17 PM|LINK
Well, you can accomplish this quite easily by using code behind. Double click the link and have an identical control called lblLink with the same text. Set its visibility to false on page load. When you click the link (lnkMyLink for example sake) you reverse the visibility:
private void lnkMyLink_OnClick { lnkMyLink.Visible = false; lblLink.Visible = true; }or you could also do it this way without the identical label:
private void lnkMyLink_OnClick { lnkMyLink.enabled = false; }MetalAsp.Net
All-Star
112752 Points
18373 Posts
Moderator
Re: disable a link button
Feb 17, 2011 12:24 PM|LINK
If by "appear as a label" you mean remove the underline, you can use the CSS style: style="text-decoration:none", or add it in code via the Style property.
Qin Dian Tan...
All-Star
113532 Points
12480 Posts
Microsoft
Re: disable a link button
Feb 21, 2011 06:53 AM|LINK
Hi,
Still refer your another post for my reply:
http://forums.asp.net/p/1654295/4312237.aspx/1?Re+Add+controls+to+a+Grid+View+programatically
Thanks,
If you have any feedback about my replies, please contactmsdnmg@microsoft.com.
Microsoft One Code Framework