我还尝试了以下代码..尝试使用处理程序
在索引.aspx
<ext:Store ID="Store1" IsPagingStore="true" runat="server">
<Proxy>
<ext:AjaxProxy Url="../../Shared/JsonHandler.ashx">
<ActionMethods Read="GET" />
<Reader>
<ext:JsonReader Root="names" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="name" Type="String" Mapping="nameList" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
在 JsonHandler.ashx 中
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType ="text/json";
var requestParams = new StoreRequestParameters(context);
FormExampleController ex=new FormExampleController ();
var list = ex.getValue();
context.Response.Write(string.Format("{{'Names':{0}}}",JSON.Serialize(list)));
}
在表单控制器中
public List<string> getValue()
{
FormUser user = new FormUser();
user.nameList = new List<string>
{
"A",
"B",
"C",
"D"
};
return user.nameList;
}
这里再次将值传递给处理程序,但组合框显示为空!有什么建议吗?