SIGN UP MEMBER LOGIN:    
ARTICLE

Drop Down List in AJAX Update Panel

Posted by Dorababu M Articles | AJAX in C# August 03, 2011
In this article I am going to show how to use Drop down list in AJAX update panel.
Reader Level:
Download Files:
 


Recently I come across a situation of how to open a new tab upon selecting a particular item from a drop down list which was inside an update panel.

So in this article I am going to show how I achieved that.

This is what I have in my design part:

<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlAuthoritytype" EventName="SelectedIndexChanged" />|
            </Triggers>
            <ContentTemplate>
                <asp:DropDownList ID="ddlAuthoritytype" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlAuthoritytype_SelectedIndexChanged">
                    <asp:ListItem Text="One"></asp:ListItem>
                    <asp:ListItem Text="Two"></asp:ListItem>
                    <asp:ListItem Text="Three"></asp:ListItem>
                </asp:DropDownList>
            </ContentTemplate>
        </asp:UpdatePanel>

A sample of the code I used for opening in a new tab is as follows:

var script = string.Format("window.open('{0}://{1}{2}{3}')", Request.Url.Scheme,
Request.Url.Host, port, ResolveUrl("~/Default2.aspx"));
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", script,
true);

Sample pages:

Default Page:

Drop down list in AJAX update panel

On selecting the required item it will open the corresponding page based on the drop down value you selected.

When One is selected the page will display as follows:

Drop down list in AJAX update panel

Like that for corresponding selection the respective pages are loaded.

Find out the attachment for further reference.
 

Login to add your contents and source code to this article
share this article :
post comment
 
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
Become a Sponsor