Reputation: 1211
Can any one tell me how to create a label and put it in href tag using c# code. this is because, I need to use a single asp label control for both as label and link label.
So I want it to be programatically set based on certain parameter values. and this is ausercontro as well. Note: I cannot change the logic because this is client's requirement
regards, Sivajih S.
Upvotes: 0
Views: 460
Reputation: 6103
Use asp:HyperLink
control !
In your aspx
,
<asp:HyperLink ID="yourHyperLink" runat="server" >
</asp:HyperLink>
In your cs
,
if(....yourCondition...)
{
yourHyperLink.Text = "YourText";
yourHyperLink.NavigateUrl = "YourURL";
}
Upvotes: 2