Creating a modal dialog popup is common in most enterprise web application especially to display lookup tables values and return back the values from the lookup table to its parent page. In ASP.NET 1.1 and also ASP.NET 2.0 I created the lookup table by using Javascript showDialog method or just using window.open methods. But how about if I want to open and return the modal dialog value from master page content. We cannot ad the inside the content page. The trick is to add the javascript function into one .js file and refer the external .js file is master page itself and let it inherit to all the content page. This techniques implemented by TimeTracker starter kits. But it takes lots of efforts. The steps is to create the external javascript script file, refer the file in master page, and call the javascript function in contentplaceholder page. The steps seems simple, but for me, its tedius, unless we create a generic script so that it can be reusable each time we want to call a modal dialog.
here's example of javascript function:
function
OpenPopup (pageUrl, controlID, isPostBack){
popUp=window.open(pageUrl+
'?controlID='+controlID+'&isPostBack='+ isPostBack,'popupcal', 'width=250,height=300,left=200,top=250');
}
we can add the javascript function using attributes.add method
Button1.Attributes.Add("OnClick", "OpenPopupPage(controlID, isPostBack, windowSetting);");
Until next time and Happy holiday.
[update 22/12]
I think this article is a good solution to the web modal dialog: http://weblogs.asp.net/jezell/archive/2003/08/26/25450.aspx