jQuery get list from C# code behide -


i have c# code behide return list of string:

public list<string> gostatuslist { {    return getstatuslist(); } } 

can use in jquery, like:

var statuslist = $('#<%=gostatuslist %>'); 

thanks!

public list<string> gostatuslist { {    return getstatuslist(); } }  

var statuslist = $('#<%=gostatuslist %>'); // not give list give type of list.

instead in c# code write :

  scriptmanager.registerstartupscript(this, typeof(page), "getlist",  "getstatuslist ([" + string.join(",",gostatuslist ) +"]);", true); 

in javascript can :

   function getstatuslist (gostatuslist)     {     // logic here                 var data = gostatuslist.d; // check per application                 $.each(data , function(index, item) {                     alert(item);//here items of list                 });     } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -