Open FancyBox from Code behind on button click
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”);
alink.click();
}
[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()
sb.AppendFormat(“OpenValidationMessagePopup();”)
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 !
Comments