Open Fancy Box On Clicking a Button

Sunday, 30 March 2014

Open Fancy Box On Clicking a Button

Open Fancy Box On Clicking a Button 

Control needed :
1: A button 
2: Literal control 
3: Anchor Control  

Aspx page coding

  <asp:Button ID="Btn_submit" runat="server"  Text="Submit" Visible="False"   />
              <a id="hidden_link" runat="server" style="visible:false" ></a>
 <asp:Literal ID="Literal1" runat="server"></asp:Literal>

Scripting Code

 <script type="text/javascript">
        $(document).ready(function () {
            $("#ctl00_Controlplaceholdername_hidden_link").fancybox({
                'width': '99%',
                'height': '92%',
                'autoScale': false,
                'transitionIn': 'none',
                'transitionOut': 'none',
                'type': 'iframe',
                'hideOnOverlayClick': false
            });
        });

       
    </script>










Aspx.cs Page coding

 hidden_link.Attributes("href") = "pagename.aspx
 Literal1.Text = "<script>jQuery(document).ready(function() {$(""#ctl00_Controlplaceholdername_hidden_link"").trigger('click');});</script>"           

* if master page is taken then hidden link id will be "#ctl00_Controlplaceholdername_hidden_link"
* other wise  "#hidden_link"