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

  • SEARCH
  • Home
  • 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 1111597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:34:21+00:00 2026-05-17T02:34:21+00:00

I know how to approach this problem but i have very little experience dealing

  • 0

I know how to approach this problem but i have very little experience dealing with anything web related.

The situation is: I have a controller that returns a view with a user control in it. Inside the user control i have 3 drop down lists; one for companies, one for field offices and one for facilities. When the companies ddl is altered, the field office and facility ddls should change, and when the field office ddl is altered the facility ddl should change.

Index.aspx
‘<%@ Page Title=”ManifestSearchPage” AutoEventWireup=”true” Language=”C#” MasterPageFile=”~/Views/Shared/Site.Master” Inherits=”System.Web.Mvc.ViewPage”%>

Manifest

<form id="form1" runat="server">

<% using (Html.BeginForm()) { %>
    <fieldset>
        <legend><h2>Find a Manifest</h2></legend>
        <table>
            <tr>
                <td>
                    <img src="../../Content/magnify-large.jpg" width="111" height="111" align="middle"></img>
                </td>
                <td>
                    <% Html.RenderPartial("../Shared/EditorTemplates/ManifestSearch");%>
                </td>
            </tr>
        </table>
    </fieldset>
<%

} %>

<h2>Search Results</h2>
<div id="resultspanel">
    <table>
        <tr>
        </tr>
        <% foreach (var item in Model.SearchResults) { %>
           <tr>
            <td>
                blargh
            </td>
           </tr>
    <% } %>
    </table>
</div>

</form>

‘

ManifestSearch.aspx
‘
<%@ Control Language=”C#” Inherits=”System.Web.Mvc.ViewUserControl” %>

<% using (Html.BeginForm()) {%>
    <%: Html.ValidationSummary(true) %>

    <fieldset>
        <legend>Fields</legend>
            <table>
                <tr>
                    <td>
                        <%: Html.LabelFor(model => model.ManifestPartialId) %>
                        <%: Html.CheckBoxFor(model => model.SearchByManifestPartialId)%>
                        <%: Html.ValidationMessageFor(model => model.SearchByManifestPartialId) %>
                    </td>
                    <td>
                        <%: Html.LabelFor(model => model.CompanyId) %>
                        <%: Html.CheckBoxFor(model => model.SearchByCompanyId)%>
                        <%: Html.ValidationMessageFor(model => model.SearchByCompanyId) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%: Html.TextBoxFor(model => model.ManifestPartialId) %>
                        <%: Html.ValidationMessageFor(model => model.ManifestPartialId) %>
                    </td>
                    <td>
                        <%: Html.DropDownList("CompanyId", new SelectList(ViewData["Companies"] as IEnumerable,"Id","CompanyName", Model.CompanyId))%>
                        <%: Html.ValidationMessageFor(model => model.CompanyId) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%: Html.LabelFor(model => model.FieldOfficeId) %>
                        <%: Html.CheckBoxFor(model => model.SearchByFieldOfficeId)%>
                        <%: Html.ValidationMessageFor(model => model.SearchByFieldOfficeId) %>
                    </td>
                    <td>
                        <%: Html.LabelFor(model => model.FacilityId) %>
                        <%: Html.CheckBoxFor(model => model.SearchByFacilityId)%>
                        <%: Html.ValidationMessageFor(model => model.SearchByFacilityId) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%: Html.DropDownList("FieldOfficeId", new SelectList(ViewData["FieldOffices"] as IEnumerable, "Id", "FacilityName", Model.FieldOfficeId))%>
                        <%: Html.ValidationMessageFor(model => model.FieldOfficeId) %>
                    </td>
                    <td>
                        <%: Html.DropDownList("FacilityId", new SelectList(ViewData["Facilities"] as IEnumerable, "Id", "FacilityName", Model.FacilityId))%>
                        <%: Html.ValidationMessageFor(model => model.FacilityId) %>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%: Html.LabelFor(model => model.SearchByDateTime) %>
                        <%: Html.CheckBoxFor(model => model.SearchByDateTime) %>
                        <%: Html.ValidationMessageFor(model => model.SearchByDateTime) %>
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td>
                        <%: Html.LabelFor(model => model.FromDate) %>
                        <%: Html.TextBoxFor(model => model.FromDate) %>
                        <%: Html.ValidationMessageFor(model => model.FromDate) %>
                    </td>
                    <td>
                        <%: Html.LabelFor(model => model.ToDate) %>
                        <%: Html.TextBoxFor(model => model.ToDate) %>
                        <%: Html.ValidationMessageFor(model => model.ToDate) %>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <input type="submit" value="Search" />
                    </td>
                </tr>
            </table>   
    </fieldset>

<% } %>

‘

This all works, with the exception of my requirement of my dropdownlists not being linked.

I know i have to use Javascript to accomplish my requirement of related dropdownlists but i have no idea how to even approach it. Ive found some tutorials, but none seem to relate to the way i have my code set up. Can anyone help with this?

  • 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-17T02:34:22+00:00Added an answer on May 17, 2026 at 2:34 am

    First, for all the jQuery people here

    If you’re using jQuery you can use the Change Event Handler to alter you dropdown menus.

    $('#firstSelect').change(function() {
      // DO STUFF
    });
    

    If you don’t use jQuery on could use the onchange attribute on your dropdown menu

    <script type="text/javascript>
    function doStuffOnChange() {
       // DO STUFF
    }
    </script>
    
    <select id="firstSelect" onchange="doStuffOnChange();">
    

    You can add HTML Attributes with HTML Helpers by using this variant

    public static MvcHtmlString DropDownList(
        this HtmlHelper htmlHelper,
        string name,
        IEnumerable<SelectListItem> selectList,
        IDictionary<string, Object> htmlAttributes
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to know if there's a better approach to this problem. I want
this problem is not really uncommon, but i don't really have an idea how
I'd like to know whether this approach is correct or if their are better
First of all I don't know if this is the right approach. I want
The Cardcase application lets you know if you approach a shop which you have
I was thinking about a typical problem that is very JIT-able, but hard to
I know this question has been asked quite a few times, however, I have
I am having trouble figuring out exactly how to approach this problem and am
I've done very little with batch files but I'm trying to track down a
note: this is a direct follow up to this previous question I have very

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.