I have a jquery JStree and after selecting node I use ajax to post the selected node to server. In code behind , a method get this nodeID and everything works correctly.
$("#tree1").bind("select_node.jstree", function (e, data) {if (jQuery.attr(data.rslt.obj[0], "href")){window.location = jQuery.attr(data.rslt.obj[0], "#div2"); }if (jQuery.attr(data.rslt.obj[0], "id")){// alert(jQuery.attr(data.rslt.obj[0], "id"));document.getElementById('<%= hdFolderID.ClientID %>').value =jQuery.attr(data.rslt.obj[0], "id"); } $.ajax({type: "POST",url: "FolderPage.aspx/GetSelectedFolder",
contentType: "application/json; charset=utf-8",
data: "{'FolderID': '" + jQuery.attr(data.rslt.obj[0], "id") + "'}",
dataType: "json",success: function (response) { } }); });
code behind:
[WebMethod(EnableSession = true)]
public
static void GetSelectedFolder(int FolderID)
{new FolderPage().ShowFilesForSelectedFolder(FolderID);
}
In ShowFilesForSelectedFolder method I use this FolderID to populate other details on a gridview.But I can not bind the data in gridview and get this eror: Object reference not set to an instance of an object.after ajax POST to set a value for any page control I get this error.
gridview1.DataSource = results;
gridview1
.DataBind();
How can I access to page controls?