Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to use a tag with click event and the href link I need to write it in code behind
when the link is clicked it will be opened on iframe by writing iframe id in the target of a tag

I tried the code below

please help

What I have tried:

ASP.NET
<ul><li><a id="urlbb"   runat="server" >web1</li></ul>
 <asp:PlaceHolder ID="url" runat="server" Visible="false">
 <iframe name="aa" width="100%" height="800px" style="margin-top:50px"></iframe>
              <asp:PlaceHolder ID="mainbody" runat="server" Visible="true">



Code behind
C#
protected void urlbb_ServerClick(object sender, EventArgs e)
   {
       mainbody.Visible = false;
       url.Visible = true;
       urlbb.Target = "aa";
       urlbb.HRef = "http://www.bradford.ac.uk/it-services/students/email/";
   }
Posted
Updated 24-Aug-16 10:45am
v2

1 solution

use Link Button [^]
ASP.NET
<asp:LinkButton ID="urlbb" runat="server" OnClick="urlbb_Click">Web 1</asp:LinkButton>
 
Share this answer
 
Comments
Member 12618369 25-Aug-16 4:23am    
Thanks but link button not working as a tag in my case I need to use a tag
Karthik_Mahalingam 25-Aug-16 4:31am    
how do u need the functionality.
i shall help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900