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

How do I change just the year component of a date using Excel formulas?
With the UK VAT rate due to change in the New Year, several clients
I am trying to change a variable that is outside of a function, from
SELECT YEAR(aum.AUM_Timeperiod) as Year, DATEPART(q, aum.AUM_TimePeriod) AS Quarter, SUM(cast(aum.AUM_AssetValue AS money)) as total_AssetValue FROM
I received a change request and I'm unsure how to best approach it. If
I am trying to use php datetime object for handling dates. Here is my
I am trying to manage seasonal prices for hotel rooms. The only way that
I am trying to use the built in .NET application settings. So for instance
My Java application needs to send an email out to all users once per
I've got this field in my database year_start_1 and it is an integer field

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.