I'm calling a method in my C# code that takes 2 ListBox objects and a GridView as parameters. How do I pass these, what I've tried throws an error saying the parameters are missing.
var visList = document.getElementById("<%= shown_ListBox.ClientID%>");
var hidList = document.getElementById("<%= hidden_ListBox.ClientID%>");
var gv = document.getElementById("<%= hm_GridView.ClientID%>")
$.ajax({
type: "POST",
url: "heatmap.aspx/manageCol",
data: JSON.stringify({visList, hidList, gv}),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (res) {
alert("success");
},
error: function (res, msg, code) {
// log the error to the console
} //error
});
public static void manageCol(ListBox visList, ListBox hidList, GridView gv)
{
//Stuff
}
stringify({shown, hidden, gv}. Also, it is very odd to post lists and gridviews becaise they will have so much html; normally you would post the data which is being manipulated in those controls. For example, you may have a gridview for manipulating student records and you will post only those student records which have been changed.