This is a migrated thread and some comments may be shown as answers.

[Solved] I am trying to get a comma delimited list of all id's in my grid they all ive at column 0

0 Answers 153 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jim
Top achievements
Rank 1
Jim asked on 31 Oct 2011, 04:00 PM
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
Tags
Grid
Asked by
Jim
Top achievements
Rank 1
Share this question
or