Posts Tagged ‘fancybox’

Set focus on textbox

November 16, 2016 Leave a comment

Using Jquery

$(function() {

Using Javascript
window.onload = function() {


Categories: ASP.NET, Code Project Tags: , , ,

Open FancyBox from Code behind on button click

November 25, 2014 Leave a comment

Add link like following which redirect to popup page that you want to open on button click using fancybox

[1] <a href=”../Scripts/ValidationMessage.aspx” class=”fancybox fancybox.iframe” id=”hiddenlink_confirm” />

Add following js function on head of page along with fancybox script

[2] <script type=”text/javascript”>

function OpenValidationMessagePopup() {
var alink = document.getElementById(“hiddenlink_confirm”);;

[3] Write following code on button click event

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click

Dim sb As New StringBuilder()

ScriptManager.RegisterStartupScript(Me.Page, Me.[GetType](), “OpenValidationMessagePopup” + DateAndTime.Now, sb.ToString(), True)

End Sub

Will add some more information to the above steps, hope this help !

Set Fancybox height and width

April 16, 2014 Leave a comment


To set height and width of fancybox popup add following script in page head section


<script language=”javascript” type=”text/javascript”>

$(document).ready(function () {

‘width’: 850,
‘height’: 800,
‘transitionIn’: ‘elastic’, // this option is for v1.3.4
‘transitionOut’: ‘elastic’, // this option is for v1.3.4
// if using v2.x AND set class fancybox.iframe, you may not need this
‘type’: ‘iframe’,
// if you want your iframe always will be 600×250 regardless the viewport size
‘fitToView’: false // use autoScale for v1.3.4



Hope it helps !