Monday, January 21, 2013

How to work iframe in Link label Click?


Steps
1     
                1)     Create a New Web application in Asp.net







            2)      Then type this java Script code  in Head tag



<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">

   <script type="text/javascript">


         function showIframe()
         {

            var iframe = document.getElementById("<%=iframe1.ClientID %>");
                   iframe.setAttribute("src", "Newpage.aspx");
                   iframe.style.display = "block";

            
         }
       </script>
     </asp:Content>



3              3)      Then Create a Iframe and call the fuction in LinkLabel onClientClick Event


   
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
           <iframe id="iframe1" runat="server style="display:none;" />

        <asp:LinkButton ID="lLife" runat="server" OnClientClick="showIframe(); return                       false;">Link</asp:LinkButton>
  
   </asp:Content>

       
       4)Then Run the Program and click in the Link

                   
      


                     
    

     

No comments:

Post a Comment

Comment Here..