I am unable to load a webgrid dynamically as the source bound to it is null. the datasource gets loaded only after selecting the dropdownlist item, then on selection change it calls an ActionResult through an Ajax call, then binds the html to the Webgrid. But before it runs the project, it throws an exception like "Object reference not set to an instance of an object." . because the datasource I have assigned is null and loads only after the selection of dropdownlist.
I have tried by putting the If statement for checking null, for the webgrid Div, but after loading the values also, its not showing the grid.If checking is not working.
Note: I am binding to the grid by Ajax call when the item gets selected from the dropdown by Ajax call as
success: function (result) {
$("#GridTable").html(result);
},
Any Solution for this?