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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:12:58+00:00 2026-05-31T06:12:58+00:00

What is a good way to attach a client-side Jquery call inside the change

  • 0

What is a good way to attach a client-side Jquery call inside the change event of a ASP dropdownlist?

I have read that the registerstartupscript is obsolete, but I do not see what is the better way to do that now. I want to mix JQ in the code behind so that it will be easier to maintain. Rather than doing a check inside of a JQ block to detect a change in the select and then calling toggle()

Is there a better way than this? What is the new way that replaces the obsolete register script methods?

protected void SearchDropDown_SelectedIndexChanged(object sender, EventArgs e)
        {

            switch (SearchDropDown.SelectedItem.Value)
            {
                case "Category":
                    CategorySearch.Visible = true;
                    NameSearch.Visible = false;
                    SearchText.Visible = false;
                    Response.Write("<script type='text/javascript'>$('#category-container').toggle();</script>");
                    break;
                case "Name":
                    NameSearch.Visible = true;
                    CategorySearch.Visible = false;
                    SearchText.Visible = false;
                    Response.Write("<script type='text/javascript'>$('#name-container').toggle();</script>");
                    break;
                default:
                    SearchText.Visible = true;
                    NameSearch.Visible = false;
                    CategorySearch.Visible = false;
                    Response.Write("<script type='text/javascript'>$('#search-container').toggle();</script>");
                    break;
            }

}
  • 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-31T06:12:59+00:00Added an answer on May 31, 2026 at 6:12 am

    Do it all client-side in jQuery. I think that is the simplest way you could do it. I don’t think I’ve ever seen the mix of Javascript in code making things easier to maintain. In fact, I’d say it makes things harder to maintain.

    Not to mention, doing all of this client-side will be faster and a better experience for the user to not have to have wait for a post-back/page load.

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

Sidebar

Related Questions

Is there a good way to create a form in VB6 that can easily
Does anyone have a good way to build MSI (vdproj) projects using MsBuild or
I am a perl developer that has never went into the client side programming
Is there any way to attach a listener to FullCalendar that will be fired
So, I've read that it is not a good idea to install VS2008 on
The problem: I have a jQuery heavy page that has a built in admin
Is there a good way to implement an execution policy that determines which Thread
Is there any good way to deal with the class renaming refactor from Resharper
Is there a good way for displaying unicode text in opengl under Windows? For
What is a good way to remove the code from display pages when developing

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.