Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Dear All,
 

I want to populate a dropdownlist on the selected index changed of the other dropdownlist without postback.
 

Could you please tell me how to do that using jquery as if i use traditional Ajax to call the code behind of same page,i will have to go through page_load event also which i want to avoid.
 
i mean --
 
XMLHTTP.open("POST", "Inbox_Grid.aspx", True);
 

This will call the code behind of "Inbox_Grid.aspx" starting from page load.But i dont want to execute that,
Please suggest!!
Posted 30-Jan-13 1:09am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Ankur,
 
Thanks alot for the help.Seems it will solve the issue.I am trying but i have no experience of Jquery.
 
I am using the below code in JS
 
$ddlFrom = $('#DrpSearch');
 
$ddlFrom.change(
    function () {
        $.ajax({
            type: "GET",
            url: "NGTPInbox_Grid.aspx/fPopulateSearch",
            data: { ddlFrom: $ddlFrom.attr("selectedIndex") },
            success: function (data) {
                $("#DrpFromList").html(data)
            }
        });
    }
);
 
and my list is like--
 

<select id="DrpSearch" class="MedBodyTextBlack" style="width: 120">
    <option value="ALL"  selected="selected">ALL</option>
    <option value="From" selected="selected">From</option>
    <option value="DATEANDTIME" selected="selected">DATEANDTIME</option>
    <option value="Form Name" selected="selected">Form Name</option>
    <option value="Form No" selected="selected">Form No</option>
    <option value="DECISION" selected="selected">DECISION</option>
    <option value="VALUE" selected="selected">VALUE</option>
</select>
 
I am not able to call the function "fPopulateSearch"
 

which is defined in code behind of the same page.
 
Suggest me where i am wrong?
 
thanks.
  Permalink  
Comments
gouravkaila at 30-Jan-13 9:12am
   
And one more confusion....
 
is it required to declare the function to be called ad Static????
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check out this article - Using jQuery to directly call ASP.NET AJAX page methods[^].
I remember reading this while first implementing the scenario you mentioned. It's neat and simple.
 
There are many other on the web - calling asp.net server side code using jquery[^]
 
Hope this helps!
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 620
1 Maciej Los 610
2 CPallini 255
3 RyanDev 161
4 Peter Leow 125
0 OriginalGriff 5,784
1 Sergey Alexandrovich Kryukov 4,838
2 Peter Leow 3,009
3 Maciej Los 2,894
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 30 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100