Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 975429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:35:02+00:00 2026-05-16T03:35:02+00:00

I have a Content Page with drop down lists within an update panel: <asp:UpdatePanel

  • 0

I have a Content Page with drop down lists within an update panel:

             <asp:UpdatePanel ID="upVehicleFilter" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>

                    <asp:DropDownList id="ddlYear" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlYear_SelectedIndexChanged"></asp:DropDownList>
                    <asp:DropDownList id="ddlMake" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlMake_SelectedIndexChanged"></asp:DropDownList>
                    <asp:DropDownList id="ddlModel" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlModel_SelectedIndexChanged"></asp:DropDownList>
                    <asp:DropDownList id="ddlEngine" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlEngine_SelectedIndexChanged"></asp:DropDownList>
                    <asp:DropDownList id="ddlAspiration" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlAspiration_SelectedIndexChanged"></asp:DropDownList>
                    <asp:DropDownList id="ddlEngVin" runat="server"></asp:DropDownList>
                    <asp:ImageButton id="btnGo" runat="server" ImageUrl="/images/buttons/btn_go.gif" OnClick="btnVehicleGo_Click"></asp:ImageButton>

                </ContentTemplate>
            </asp:UpdatePanel>

the logic(events) also exists on the Content Page:

protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)...
protected void ddlMake_SelectedIndexChanged(object sender, EventArgs e)...
protected void ddlModel_SelectedIndexChanged(object sender, EventArgs e)...
protected void ddlEngine_SelectedIndexChanged(object sender, EventArgs e)...
protected void ddlAspiration_SelectedIndexChanged(object sender, EventArgs e)...
protected void btnVehicleGo_Click(object sender, ImageClickEventArgs e)...

Basically it’s a cascading drop down lists. When some value has been selected on Year it will populate Make and so on.

My issue now, is I need to move the markup to Master Page and retain the Logic on Content Page. How would I be able to attain this? What are my options and/or alternatives?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:35:02+00:00Added an answer on May 16, 2026 at 3:35 am

    Something like this would do the trick in your Content Page code behind:

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
    
        DropDownList ddlYear = ((SiteMaster)this.Master).FindControl("ddlYear") as DropDownList;
        ddlYear.SelectedIndexChanged += new EventHandler(ddlYear_SelectedIndexChanged);
    }
    
    void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
    {
        throw new NotImplementedException();
    }
    

    You will need to remove OnSelectedIndexChanged attributes from the drop down lists on the master page. You will also need to replace SiteMaster with whatever the type of your master page is.

    This will work, but you might consider keeping the event handlers in the master page and exposing new events from the master page that fire when the drop downs change. This would eliminate the need for your child pages to know the names of the controls on the master page, which is not ideal.

    Update:
    If the DropDown lists need to be in the Master solely for layout purposes, add an additional ContentTemplate to the master page. This will allow you to place the DropDowns wherever they need to appear, but maintain the logic in the Content pages. This will be cleaner than having half the code in one place, and half in another and relying on FindControl to link the two.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.