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
Post a Comment