This question is locked. New answers and comments are not allowed.
I need to get a list of all id's on my grid and pass them back to my controller as a comma delimited list:
I have the following function but being a C# ASP.net Newb (20 years of delphi) I have no idea how to do this. I have this function to try and gather my id's it does not work:
function getIdListClean() {
var ids=null;
var grid = $('#Grid').data('tGrid'); //# + the name given to the grid
$(grid.$tbody[0].rows).filter(function() {
//alert ($(this).html());
alert ($(this).html());
if (ids==null) {
alert ('$(this)[0].html() ' + $(this)[0]);
try
{
ids=$(this)[0].html();
}
catch(err)
{
alert (err.description);
}
}
else {
alert ('12');
ids=ids + "," + $(this)[0].html();
}
alert ('13');
return $(this)[0].html();
});
return ids;
}
And the following function that calls it:
$('#exportSelected').click(function () {
var url = '<%= ResolveUrl("~") %>Customers/ExportToExcel/?data='+getIdListClean();
window.location = url;
});
This should be easy and i bet it is once i am showed how.
Jim
I have the following function but being a C# ASP.net Newb (20 years of delphi) I have no idea how to do this. I have this function to try and gather my id's it does not work:
function getIdListClean() {
var ids=null;
var grid = $('#Grid').data('tGrid'); //# + the name given to the grid
$(grid.$tbody[0].rows).filter(function() {
//alert ($(this).html());
alert ($(this).html());
if (ids==null) {
alert ('$(this)[0].html() ' + $(this)[0]);
try
{
ids=$(this)[0].html();
}
catch(err)
{
alert (err.description);
}
}
else {
alert ('12');
ids=ids + "," + $(this)[0].html();
}
alert ('13');
return $(this)[0].html();
});
return ids;
}
And the following function that calls it:
$('#exportSelected').click(function () {
var url = '<%= ResolveUrl("~") %>Customers/ExportToExcel/?data='+getIdListClean();
window.location = url;
});
This should be easy and i bet it is once i am showed how.
Jim