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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:37:35+00:00 2026-06-02T07:37:35+00:00

I am using Asp.Net/C# , I need to fill a dropdownlist on change of

  • 0

I am using Asp.Net/C# , I need to fill a dropdownlist on change of another dropdownlist , I could have done it using SelectedIndexChanged event by setting AutoPostBack Property to True of the first dropdownlist , but I have a password textbox which gets cleared on postback , so that solution was not feasible.I decided to use jquery ajax to call my code behind method , but I am using this approach for the first time so I cant figure out how do I go about this.Here is what I have tried so far but it is not working for me.

$('#ddlDivisionName').change(function() {
        alert('j');
        $.ajax({
            type: "POST",
            url: "/CreateAccount/CreateAccount.aspx/BranchNameFill",
            data: "{'index':1}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            async: true,
            cache: false,
            success: function() {
                alert('ok');
            }
        })
        return false;
    });

[WebMethod]
        public static string BranchNameFill(int index)
        {

            ddlBranchName.Items.Clear();   
            IEnumerable<BRANCH> br;
            br = (from b in dt.BRANCHes
                  where b.DIVNO ==index
                  select b);
            for (int i = 0; i < br.Count(); i++)
            {
                ddlBranchName.Items.Add(br.ElementAt(i).NAME.Trim());
            }





        }
  • 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-06-02T07:37:37+00:00Added an answer on June 2, 2026 at 7:37 am

    here is a simple example I hope it helps you somehow

       [WebMethod]
            public List<BRANCH> BranchNameFill(int index)
    
            {
    
                 br = (from b in dt.BRANCHes
                          where b.DIVNO ==index
                          select b);
    
    
                return br.ToList();
    
            }
    
        ajax client 
        function getCars() {
            $.ajax({   
              type: "POST",
              url: "/CreateAccount/CreateAccount.aspx/BranchNameFill",       
              data: "{'index':1}",       
              contentType: "application/json; charset=utf-8",        
              dataType: "json",        
              success: function(response) {        
                var branches = response.d;
                $('dropdownlist').empty();  
                $.each(branch, function(index, branches) {     
                  $('dropdownlist').append('<option value="' + branch.ID + '" >' + branch.NAME + '</option>');
    
                });
    
              },
    
              failure: function(msg) {
    
    
    
              }
    
            });
    
          }
    
        </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Asp.Net/C# in my application,I have a requirement where I need to
Using asp.net, I need to generate a snapshot of an youtube video. I have
We have been using asp.net mvc for development. Sometimes, we need to put some
I am using Asp.Net/C# in my application ,I have a requirement where I need
Using ASP.NET MVC + jQuery : I need to use some values owned by
I'm using ASP.NET MVC to develop a website and I need to customize my
I need to create a web application using ASP.NET MVC, jQuery and web standards
I am using asp.net C# 2008, and I need to create a search textbox
I am using asp.net 3.5 with C#. I need to do a database lookup
I'm using asp.net mvc 3, My problem is I need to use the customized

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.