Home > ASP.Net, Javascript > Open Popup window from Selected value from DropdownList

Open Popup window from Selected value from DropdownList


try this example to Open Popup window from Selected value from DropdownList

1) Create a new website and add 2 pages Default.aspx and popup.aspx

2) In Default.aspx page add DropdownList control and add List Items to it

    Select Name :
     <asp:DropDownList ID="ddl_Names" runat="server" Width="108px" >
            <asp:ListItem Value="-1">Select</asp:ListItem>
         <asp:ListItem Value="1">Yasser</asp:ListItem>
         <asp:ListItem Value="2">Ahmed</asp:ListItem>
         <asp:ListItem Value="3">Zaid</asp:ListItem>
    <a href="#" onclick="javascript:popup();return false;" /> Show Details</a>

and add this javascript code in the page

<script language="javascript" type="text/javascript">
    function popup()
        var dd=document.getElementById('<%= ddl_Names.ClientID %>').selectedIndex;
        var yr=document.getElementById('<%= ddl_Names.ClientID %>').options[dd].value;
              alert('Select Something');

3) In popup.aspx page you can get ID from Querstring passed from Default.aspx to this page

Hope this helps

Good Luck

Categories: ASP.Net, Javascript
  1. April 13, 2013 at 7:15 am

    very useful and deep article article containing everything about pop up ..I also have a blog http://webcodeexpert.blogspot.in/ for sharing these type of useful codes for the web programmers..i was searching for the popup window on dropdownlist and found your article and impressed by it..thanks. keep it up

  1. July 3, 2014 at 6:27 pm
  2. July 6, 2014 at 3:07 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: