Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery从C#代码后面获取列表_C#_Jquery_.net - Fatal编程技术网

jQuery从C#代码后面获取列表

jQuery从C#代码后面获取列表,c#,jquery,.net,C#,Jquery,.net,我在后面有C#代码来返回字符串列表: public List<string> GoStatusList { get { return GetStatusList(); } } public List GoStatusList{get{return GetStatusList();} 我可以在jQuery中使用它吗,可能类似于: var statusList = $('#<%=GoStatusList %>'); var statusList=$('#');

我在后面有C#代码来返回字符串列表:

public List<string> GoStatusList { get {    return GetStatusList(); } }
public List GoStatusList{get{return GetStatusList();}
我可以在jQuery中使用它吗,可能类似于:

var statusList = $('#<%=GoStatusList %>');
var statusList=$('#');
谢谢

public List<string> GoStatusList { get {    return GetStatusList(); } } 
在Javascript中,您可以执行以下操作:

   function GetStatusList (GoStatusList)
    {
    // logic here 
               var data = GoStatusList.d; // check as per your application
                $.each(data , function(index, item) {
                    alert(item);//Here you will get items of your list
                });
    }
在Javascript中,您可以执行以下操作:

   function GetStatusList (GoStatusList)
    {
    // logic here 
               var data = GoStatusList.d; // check as per your application
                $.each(data , function(index, item) {
                    alert(item);//Here you will get items of your list
                });
    }

在jquery中生成GoStatusList函数,并像这样从代码隐藏中调用此函数

 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "",GoStatusList()  , true);

ScriptManager.registerstartupscript(this,this.GetType(),“”,GoStatusList(),true)


希望这能帮助您

在jquery中创建GoStatusList函数,并像下面这样从代码后面调用此函数

 ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "",GoStatusList()  , true);

ScriptManager.registerstartupscript(this,this.GetType(),“”,GoStatusList(),true)


希望这对您有所帮助

谢谢。您能告诉我jQuery如何循环通过“GoStatusList”吗?我从jQuery获得的GoStatusList似乎只是一个字符串“System.Collections.Generic.List`1[System.string]”谢谢!我工作!无论如何都应该使用“”而不是[]。谢谢。您能告诉我jQuery如何循环通过“GoStatusList”吗?我从jQuery获得的GoStatusList似乎只是一个字符串“System.Collections.Generic.List`1[System.string]”谢谢!我工作!仍应使用“”而不是[]。