Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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!
 
Share this answer
 
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

PHP
$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--


XML
<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.
 
Share this answer
 
Comments
gouravkaila 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900