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 1069553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:26:11+00:00 2026-05-16T20:26:11+00:00

When I change the year in my dropdownlist, how do I refresh the grid

  • 0

When I change the year in my dropdownlist, how do I refresh the grid underneath?

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AdminAccounts.master" Inherits="System.Web.Mvc.ViewPage<SHP.WebUI.Models.BankHolidayViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    BankHoliday
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="AdminAccountsContent" runat="server">
<h3>Bank Holiday Administration</h3>
<p>Select the year: <%: Html.DropDownListFor(model => model.SelectedYear, Model.YearList)%></p>
<table>
    <tr>
        <th>Bank Holiday</th>
        <th>Date</th>
        <th>Notes</th>
    </tr>
    <% foreach (var bankHolidayExtended in Model.BankHolidays)
    { %>
        <% Html.RenderPartial("BankHolidaySummary", bankHolidayExtended); %>
    <% } %>
</table>

  • 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-16T20:26:12+00:00Added an answer on May 16, 2026 at 8:26 pm

    The easiest way would be to create a tag that will be the target where your grid will be displayed from an AJAX call:

    <div id="bankHolidays"></div>
    

    Then you’re jQuery would look like this:

    $(function() {
        $("#SelectedYear").change(function() {
            var year = $("#SelectedYear").val();
            $("#bankHolidays").load("/YourController/BankHolidays/" + year);
        });
    });
    

    Then you just create a controller action called BankHolidays:

    public ActionResult BankHolidays(int year)
    {
      this.ViewData.Model = repository.GetBankHolidaysForYear(year);
      return this.View();
    }
    

    Finally, in your BankHolidays.ascx you move your foreach loop from above in there and the model for that BankHolidays.ascx is your IEnumerable. This fragment of HTML will be returned in the AJAX call. jQuery will set that HTML to be the HTML inside the “bankHolidays” tag.

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

Sidebar

Related Questions

With the jQuery datepicker, how does one change the year range that is displayed?
How can I change the title of the command prompt window every time I
Change Data Capture is a new feature in SQL Server 2008. From MSDN: Change
How would I change the initial templates created by Xcode when creating a new
Is it possible to change the width of a scroll bar on a form.
Lately I had to change some code on older systems where not all of
How can I change default Generate Method Stub behavior in Visaul Studio to generate
How do I change font size on the DataGridView?
How can I change the width of a textarea form element if I used
Is it possible to change the font size used in a ContextMenu using the

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.