Mathematics
Mathematics

Reputation: 7628

Can I use jquery Drop down list instead of ASP.NET

At the moment I am using ASP.NET drop down list, but I am having problem with post backs, so I was wondering if I could use jquery select menu instead, not sure how to though, someone guide please,

Here's my ASP.NET drop down list code,

Drop Down List resets

Here is the plugin I want to use,

http://www.bulgaria-web-developers.com/projects/javascript/selectbox/index.php?country_id=5&city_id=&vehicle_id=&language=

Only thing I am confused is, how can I populate jQuery select menu using SQL DataSource.

Upvotes: 1

Views: 1075

Answers (1)

Joe Korolewicz
Joe Korolewicz

Reputation: 472

So essentially, you need a way to get the information from your server to the client. There are two ways you can do this.

  1. Use an Ajax call to pull in your information. Of course, in this case, you will need to create an endpoint for your Ajax to hit.

    var yourList;
    $.post("GetDataService.svc", function (returnData) {
        yourList = returnData;
    });
    
  2. Save the server object as a javascript object using ASP tags.

    <script type="text/javascript">
        var yourList = "<%=this.GetData() %>";
    </script>
    

Upvotes: 3

Related Questions