Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
JavaScript
$("#DropDownName").on("change", function () {
        var YourVariablename= $("#DropDownName").val();               
        if (YourVariablename!= "") {
            var url = '/abc/methodName';
            $.get(url,
                {
                    YourParametername: YourparameterValue
                }, function (data) { 
                   //I am getting data here.
                    var grd = $("#checkableGrid");
                   //I am getting Grid Control here
                    //How do i set this data to WebGrid Control.
                    //grd[0].dataset = data;
                    $("#checkableGrid").html(data);                  
                });

                   //$("#checkableGrid").html(data);
        //});

           
        }
        else
        {
            $('#DropDownName option:contains("--Select Status--")').prop('selected', true);
        }               
       
        });       
Posted
Updated 7-Jan-16 8:50am
v3
Comments
ZurdoDev 25-Nov-15 14:07pm    
Check data.d.
raj kumarpandey 25-Nov-15 14:30pm    
I hope you want me to make changes like below.If so its not working.I Mean Webgrid is not populating with new data.

You wanted me to use data.d instead of data.
$("#checkableGrid").html(data.d);

This is MVC WebGrid Control.
ZurdoDev 25-Nov-15 18:31pm    
Debug and see what is coming back in data.

1 solution

I have completed this.below is the code.


Jquery Changes


/While changing status in drop Down filtering
function ChangeStatus() {
$("#DropDownName").on("change", function () {
var YourVariablename= $("#DropDownName").val();
if (YourVariablename!= "") {

RenderItemsList(CRFStatusID);
}
else
{
$('#DropDownName option:contains("--Select Status--")').prop('selected', true);
}
});
}


JavaScript
function RenderItemsList(CRFStatusID) {
    $.ajax({
        url: '/abc/methodName',
        type: 'post',
        cache: false,
        async: false,
        data: { YourParameterName: YourParameterValue},
        success: function (result) {
            RenderListView(result);
        }
    });    
}




JavaScript
function RenderListView(result) {
    $('#divpartialListContainer').empty();
    $('#divpartialListContainer').html(result);
    $('#divpartialListContainer').show();      
}




<div id="divpartialListContainer" class="gc-div-list">
@Html.Partial("_PartialList", Model)
</div>
 
Share this answer
 
v2

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