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 2:09am
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  
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????

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

  Print Answers RSS
0 OriginalGriff 459
1 Maciej Los 325
2 Sergey Alexandrovich Kryukov 234
3 DamithSL 233
4 BillWoodruff 200
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.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