jQuery从C#代码后面获取列表
我在后面有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=$('#');
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]”谢谢!我工作!仍应使用“”而不是[]。