Programming is Passion,Software Development is an Adventure- Willy David Jr

Programming is Passion,Software Development is an Adventure- Willy David Jr

Problem on Postback when using Modal Pop-up Window

I was doing an online job application this week when I encounter this problem. I can create Modal pop-up window using BLOCKED SCRIPT

myLinkButton.Attributes.Add("onclick", "BLOCKED SCRIPTwindow.showModalDialog('http://" + myUrl + "')");

Everything works fine, because the user cannot navigate to any other page unless he/she closes the window first. Until one thing, when he presses or click the Submit button of the modal popup, another window opens, the same window and URL I used on my modal pop-up. The problem was, you cannot make a postback inside a modal pop-up window. It will just trigger the same problem as I does.

Anyhow, we are already on information age, and I found one very good solution to this, create a new web form page, put a frame control on the page, and link that frame control to your modal pop-up window. Here is the code for my FrameApplicationForm.aspx:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrameApplicationForm.aspx.cs" Inherits="Portals_0_Skins_GurangoSkin_MainUserControls_FrameApplicationForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<HEAD>
<TITLE>Online JOB Application</TITLE>
</HEAD>
<frameset rows="100%">
    <frame name="mainframe" src="ApplicationForm.aspx" bordercolor="0" title="Navigation bar">    <--- Link your modal pop-up window here
</frameset>
</html>

 

The on the javascript declaration, use the url of this frame application form page:

string myURLforFrameApplicationPage= "~/FrameApplicationForm.aspx";

myLinkButton.Attributes.Add("onclick", "javascript : window.showModalDialog('http://" + myURLforFrameApplicationPage+ "')");

 

Now everything works fine, and I can now proceed to my next task! :)

 

// Willy David Jr

Comments

terabyte said:

what is a BLOCKED SCRIPT?

# July 24, 2008 11:34 PM

willydavidjr said:

Sorry for that terabyte, I edited my post. Nevermind the BLOCKED SCRIPT. - Willy David Jr

# July 24, 2008 11:46 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: