popup windows usage is one of the every day tasks for any web developer. The problem of the normal html simple popups that it is usually blocked by the browser of the client also it is not attractive specially if you are developing a web site that need to be very attractive. So in such cases you will need ajax popup instead.
I searched the web allot in the end i can say that the best options you have as a asp.net developer are
1-The modal popup extender which is part of the free asp.net ajax controls tool kit.
2-The free greybox modal popup form orangoo labs.
so i will concentrate on comparison between the two options after trying them for a long time
grey box vs modal popup extender:
i will not concentrate on the usage of the two techniques because this will be a very lengthy explanation instead i will mention an example on each one and a comparison between them .But both have a very good documentation and step by step setup in the manufacturer web sites
you can find full explanation of the modal popup extender at codeplex.com and www.asp.net website also have a very good example of using this control.
The other option (orangoo grey box) is also explained in details here.
Greybox concept:
Simply when you click on the link the greybox script take the target of any normal a link and open the target page in a good looking modal popup( this link can be generated dynamically to make a master details scenario ) peace of cake.
Modal popup extender concept:
The process is more complicated here (it is Microsoft funded project lol ) . Here you have to put the contents of the popup you want to open in an asp.net panel and the modal popup extender control taking care of hiding this panel when the page load and and showing the panel when the user click the trigger button with all of it’s contents as a popup.Notice that the popup here is part of the main page not a separate physical page like greybox and from here come the problems i think that using ajax controls toolkit on the page modifying the page life cycle some how. So you start to have unexpected problems regarding data binding and logic modification during page events which need great effort in debugging till the page work like expected.
Greybox asp.net installation and usage:
Suppose you have a product catalog(master ) and when the user press on the product image a popup is opened containing the product details(details). Using the grey box in this situation will be very easy you will be surprised by the fast results.
1- Add an asp.net listview control to the main page containing the list of products links with each link linking to the product details page by changing the query string value to the wanted ID’s (like ~/productdetails.aspx?productid=1)
2-Create the productdetails page with a formview control on the page that will display the product details . Remember to configure the sql data source to select one record based on the query string parameter passed from the products list page(make the diameters of the form view 400 * 400 pixels because this will be the diameter of the popup)
3-copy the greybox folder to your root directory
4-Append following to your header section (in between <header>…</header>).
GB_ROOT_DIR is the URL where static files are located:
<script type=”text/javascript”>
var GB_ROOT_DIR = “http://mydomain.com/greybox/”;
</script>
GB_ROOT_DIR should be absolute.
5-Append also following scripts and one stylesheet:
<script type=”text/javascript”src=”greybox/AJS.js”></script>
<script type=”text/javascript”src=”greybox/AJS_fx.js”></script>
<script type=”text/javascript”src=”greybox/gb_scripts.js”></script>
<link href=”greybox/gb_styles.css”rel=”stylesheet”type=”text/css”/>
AJS_fx.js is optional,it’s used for effects. If you don’t wish effects,then don’t include AJS_fx.js in your header section.
6-add a “rel=”gb_page[500,500]”attribute to the hyperlink data bound control inside the main page.this will make the link open the page in the popup window not a normal window
the listview must look like
</ItemTemplate>
<AlternatingItemTemplate>
<td runat=”server”style=”">
prodid:
<asp:Label ID=”prodidLabel”
runat=”server”
Text=’<%# Eval(“prodid”) %>’/>
<br />
</td>
</AlternatingItemTemplate>
and you are finished when you click on any link the product details will open in a popup window.
Modal popup control extender setting up and usage:
1-First you should prepare vwd for asp.net ajax controls toolkit learn how from here
2-As we mentioned before modal popup control extender is not opining a different physical page inside the modal popup instead it just will display the contents of the asp.net panel you select and display it using ajax as a layer over the same window. Here we will use another example (the one i already have on my pc)suppose we hade a list of categories and when the user click on an category image the popup will open containing a grid with each row have a product image and a link .so will make a asp.net page named products.aspx. The page will contain a categories datalist(the example that i have on my pc was before the great listview control) containing a list image buttons (notice not links but button to act as a trigger for the modal popup extender)
the item template code should look like this:
<ItemTemplate>
<asp:ImageButton ID=”ImageButton1″runat=”server”CausesValidation=”False”CommandName=”select”
ImageUrl=’<%# Eval(“categorylogostring”) %>’Height=”95px”Width=”95px”ImageAlign=”Middle”/>
</ItemTemplate>
2-Then we have to add a panel containing the grid view that will present the products:
<asp:Panel ID=”Panel1″runat=”server”Height=”30px”ScrollBars=”Auto”Style=”border-left-color:#ff3333;
border-bottom-color:#ff3333;border-top-style:groove;border-top-color:#ff3333;padding:20px;
border-right-style:groove;border-left-style:groove;background-color:black;
border-right-color:#ff3333;border-bottom-style:groove”Width=”50px”>
<asp:GridView ID=”GridView1″runat=”server”AutoGenerateColumns=”False”DataKeyNames=”linkid”
DataSourceID=”ObjectDataSource1″Style=”color:#ff0000″EmptyDataText=”No available links in this category ”
ShowHeader=”False”Width=”440px”BorderColor=”Black”BorderStyle=”None”BackColor=”Black”PageSize=”100″>
<Columns>
<asp:HyperLinkField DataNavigateUrlFields=”linkstring”DataNavigateUrlFormatString=”http://{0}”
DataTextField=”linkstring”>
<ItemStyle BackColor=”Black”BorderColor=”Black”BorderStyle=”None”ForeColor=”Red”/>
</asp:HyperLinkField>
<asp:ImageField DataImageUrlField=”linklogostring”DataImageUrlFormatString=”~/pictures/linkslogos/{0}”>
<ControlStyle Height=”50px”/>
<ItemStyle BackColor=”Black”BorderColor=”Black”BorderStyle=”None”/>
</asp:ImageField>
</Columns>
</asp:GridView>
<br />
<asp:Button ID=”ok”runat=”server”Text=”ok”/></asp:Panel>
3-we will add a button inside the previous panel that will act as a close button to close the popup.
<asp:Button ID=”ok”runat=”server”Text=”ok”/>
4-then add the modal popup extender control inside the same panel.
<ajaxToolkit:ModalPopupExtender ID=”PopupControlExtender1″runat=”server”
PopupControlID=”panel1″TargetControlID=”Button1″DropShadow=”false”
CancelControlID=”ok”>
</ajaxToolkit:ModalPopupExtender>
popupcontrolid is the panel that you want to appear as a popup
targetcontrolid supposed to be the the id of the control that trigger of the popup notice that we will not use it here you can make it hidden because we will show the poup dynamically from the code behind page using the selected index changed of the categories list as a trigger.
dropshadow use this if you want the main page to darken after the popup open.
cancelcontrolid is id of the button to close the popup.
5-Then rap the panel that will act as a popup with all it’s contents in an asp.net ajax update panel and configure it to be triggered by the selected index changed event of the categories datalist. so when the user press the image button inside the datalist the button trigger the selected index changed event which is assigned as a asynchronous post back event because we added it as a trigger to the update panel so the page won’t refresh and the popup appear on the page.
here is the code of the poup panel inside the update panel
<ajax1:UpdatePanel ID=”UpdatePanel1″runat=”server”ChildrenAsTriggers=”False”UpdateMode=”Conditional”>
<ContentTemplate>
<asp:Panel ID=”Panel1″runat=”server”Height=”30px”ScrollBars=”Auto”Style=”border-left-color:#ff3333;
border-bottom-color:#ff3333;border-top-style:groove;border-top-color:#ff3333;padding:20px;
border-right-style:groove;border-left-style:groove;background-color:black;
border-right-color:#ff3333;border-bottom-style:groove”Width=”50px”>
<asp:Button ID=”Button1″runat=”server”BorderStyle=”None”Style=”background-color:#000000″
Text=”Button”/>
<ajaxToolkit:ModalPopupExtender ID=”PopupControlExtender1″runat=”server”
PopupControlID=”panel1″TargetControlID=”Button1″DropShadow=”false”
BehaviorID=”mdlPopupFadeIn” CancelControlID=”ok”>
</ajaxToolkit:ModalPopupExtender>
<asp:GridView ID=”GridView1″runat=”server”AutoGenerateColumns=”False”DataKeyNames=”linkid”
DataSourceID=”ObjectDataSource1″Style=”color:#ff0000″
EmptyDataText=”No available links in this category ”ShowHeader=”False”Width=”440px”BorderColor=”Black”
BorderStyle=”None”BackColor=”Black”PageSize=”100″>
<Columns>
<asp:HyperLinkField DataNavigateUrlFields=”linkstring”DataNavigateUrlFormatString=”http://{0}”
DataTextField=”linkstring”>
<ItemStyle BackColor=”Black”BorderColor=”Black”BorderStyle=”None”ForeColor=”Red”/>
</asp:HyperLinkField>
<asp:ImageField DataImageUrlField=”linklogostring”DataImageUrlFormatString=”~/pictures/linkslogos/{0}”>
<ControlStyle Height=”50px”/>
<ItemStyle BackColor=”Black”BorderColor=”Black”BorderStyle=”None”/>
</asp:ImageField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<ajax1:AsyncPostBackTrigger ControlID=”DataList2″EventName=”SelectedIndexChanged”/>
</Triggers>
</ajax1:UpdatePanel>
6-last thing we have to add the following code behind to rebind the data base update the update panel and show the popup dynamically.
Protected Sub DataList2_SelectedIndexChanged(ByVal sender As Object,ByVal e As System.EventArgs)
Handles DataList2.SelectedIndexChanged
‘set it to true so it will render
Me.GridView1.Visible = True
‘force databinding
Me.GridView1.DataBind()
‘update the contents in the detail panel
Me.UpdatePanel1.Update()
‘show the modal popup
Me.PopupControlExtender1.Show()
End Sub
oooooooooohhhhhhhhhhhh long exhausting hard to debug code when you compare it with the greybox but remember it is also fully customizable even if you don’t know anything about javascript. you can control the borders of the popup,the way to close it,,even animating the popup while opining and closing.
gerybox performance:
The performance here is just so great the full source code of the greybox is about 22kb .it’s browser compatibility is good it just didn’t work for me with ie6
but overall the performance is so great.
Modal popup control extender performance:
Modal popup extender is part of the asp.net ajax controls toolkit .Using this controls in any page require uploading many resources file to the visitors computer this files can reach 300kb. so when the user open the page for the first time he have to wait for these files to be saved. sure it is cached to the users computer and won’t need to be downloaded again but if the user has a bad connection speed he may go and don’t comeback again thinking that the website have something wrong.
but with even a medium dsl connection speed no problems and the page will load quite easily.
Customization of greybox:
I tried to change any thing in the great greybox because i am not the javascript man and i don’t think it is easy to customize greybox .use it out of the box or leave it.
customizing modal popup extender:
it is the strong point of usong modal popup control extender you can control almost every thing even animating the popup any way you want change borders buttons shapes every thing. and the good thing that you change every thing using a normal asp.net vb.net code without any need to learn javascript.
The over all result:
you have to use greybox whenever possible for the sake of easy installation,less or no coding also superior performance.
but when you need to have full control over every thing and customizing the scenario to a very special needs use the modal popup extender specially if you are not the JavaScript guy because you will deal with a very normal asp.net control.

there are circumstances….
Right now there are over 20,000 on-line video games which you can entry…
Read was interesting,stay in touch……
[...]please visit the sites we follow,including this one,as it represents our picks from the web[...]……
[...]we came across a cool site that you might enjoy. Take a look if you want[...]……
[...]please visit the sites we follow,including this one,as it represents our picks from the web[...]……
[...]The information mentioned in the article are some of the best available [...]……
[...]below you’ll find the link to some sites that we think you should visit[...]……
skupinovy sex…
[...]Sites of interest we have a link to[...]…
noisy route…
video games can therefore be used as a means of maintaining younger folks away undesirable web pages. They’re very…
MMA Gear…
I found this really curious post today…
Websites worth visiting…
[...]here are some links to sites that we link to because we think they are worth visiting[...]……
[...]we like to honor many other internet sites on the web,even if they aren’t linked to us,by linking to them. Under are some webpages worth checking out[...]……
[...]Here are some of the sites we recommend for our visitors[...]……
Great information…
This can be very nice. Every watch this guidance quantity so we are stupefied. We are curious about this sort of accessories. Issue appreciate ones reccomendations,and treasure the effort in this. Please keep updating. These are tremendously trustwort…
Awesome website…
[...]the time to check or go to the content or websites we have linked to below the[...]…
Highly Recommended websites…
[...]Here are some of the sites we recommend for our visitors[...]…
Related Blogs…..
[...] always a huge addict of backlinking to blog writers that I like yet aren’t getting a considerable amount of link love right from [...]…
Great information…
This is often exceptional. Folk stare upon every group contented when we are bowled over. We are precisely fascinated by this sort of behaviors. Solitary appreciate slimmer s accumulate,and treasure the effort in this. Please keep add relevant content…
Websites you should visit…
[...]below you’ll find the link to some sites that we think you should visit[...]……
will you…
extra refreshing than the standard workplace work. This is where free on-line games turn out to be handy. Free online games means…
Related Sites……
[...] the best time to read or visit the actual content or sites we have linked to below the [...]…
there are circumstances….
Right now there are over 20,000 on-line video games that you could entry…
help to…
versions which are well-liked in the regions wherein you reside. But over the internet things are…
Related……
[...]just beneath,are numerous totally not related sites to ours,however,they are surely worth going over[...]……
Read More…
[...]…Very Interesting…[...]…
Gems form the internet…
[...]very few websites that happen to be detailed below,from our point of view are undoubtedly well worth checking out[...]……
[...]Sites of interest we have a link to[...]……
[...]usually posts some very interesting stuff like this. If you’re new to this site[...]……
Sources…
[...]check below,are some totally unrelated websites to ours,however,they are most trustworthy sources that we use[...]……
You should check this out…
[...] Wonderful story,reckoned we could combine a few unrelated data,nevertheless really worth taking a look,whoa did one learn about Mid East has got more problerms as well [...]……
Read More…
[...]…Very Creative…[...]…
Visitor recommendations…
[...]one of our visitors recently recommended the following website[...]……
[...]The information mentioned in the article are some of the best available [...]……
[...]below you’ll find the link to some sites that we think you should visit[...]……
Websites we think you should visit…
[...]although websites we backlink to below are considerably not related to ours,we feel they are actually worth a go through,so have a look[...]……
[...]check below,are some totally unrelated websites to ours,however,they are most trustworthy sources that we use[...]……
[...]one of our visitors recently recommended the following website[...]……
Great website…
Here are some of the sites we recommend for our visitors…
You should check this out…
[...] Wonderful story,reckoned we could combine a few unrelated data,nevertheless really worth taking a look,whoa did one learn about Mid East has got more problerms as well [...]……
Awesome Hair Styles…
Hello,I recently jumped to your internet site by way of StumbleUpon. Not one thing I’d personally normally go through,on the other hand liked your opinions it’s unlikely that any your much less. Thanks to create a thing worth reading through….
Dear Webmaster…
[...]check out this new way to make money for your blog through Facebook [...]…
Great website…
Here are some of the sites we recommend for our visitors…
could you…
find yourself with a while corresponding to throughout lunch breaks while you would need to spend your time on some thing…
Online Article……
[...]The information mentioned in the article are some of the best available [...]……
Good Blog…
After research a number of of the blog posts in your website now,and I truly like your manner of blogging. I bookmarked it to my bookmark web site list and will be checking back soon. Pls take a look at my website online as effectively and let me know…
Great information…
This can be astounding. Among watch associated with page content when we are thunderstruck. We are curious about one of these issues. Members appreciate you create hints,and enjoy your time while in this. Please keep adding information to. They’re fa…
Websites to visit…
[...] Ever reflect on where to go to for just about any weekend and wind up going nowhere but thinking you had [...]…
Wow!…
A very spectacular post….
Blogs to check…
[...] Just about every now and then we choose blogs that we read. Shown below are the most recent sites that we like [...]…
You should check this out…
[...] Wonderful story,reckoned we could combine a few unrelated data,nevertheless really worth taking a look,whoa did one learn about Mid East has got more problerms as well [...]……
Coolest blog entry……
[...] may possibly have used up the lack of this points motivated by way of oneself on [...]…
Sites You Should Check Out…
http://www.greenvalleylodge.getlisted.co.nz/rest-homes-in-auckland...
[...] Wonderful story,reckoned we could combine a few unrelated data,nevertheless really worth taking a look,whoa did one learn about Mid East has got more problerms as well [...]……
[...]although websites we backlink to below are considerably not related to ours,we feel they are actually worth a go through,so have a look[...]……
Check this out…
[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate,just click the links over[...]……
can be…
is accessible from the free web sites. You don’t want an instructor to help you find out about on-line games….
Check this out…
[...] that is the end of this article. Here you’ll find some sites that we think you’ll appreciate,just click the links over[...]……
Great website…
Cool post,I really enjoyed reading it. I will check out your site for some more content on this subject….