两种方法
1、直接返回对象列表
<DirectEvents> <Click> <ExtraParams> <ext:Prameter Name="Values" Value="Ext.encode({#GridPanelName}.getRowsValues({selectedOnly:true}))" Mode="Raw"> </ExtraParams> </Click> </DirectEvents>
string json=e.ExtraParams["Values"]; //得到json格式的数据Dictionary<string, string>[] detail = JSON.Deserialize<Dictionary<string, string>[]>(json); //反序列化json成字典foreach(Dictionary<string, string> row in sqlDetail ){ string id=row["ID"];..... 获取数据}
第一种方法:http://www.cnblogs.com/RANCY/p/4905008.html
2、返回ID列表
<script type="text/javascript"> function GetIDS() { var json = mcp_gridlist.selectedIds; var ids = ""; for (var key in json) { ids += key + ","; } ids = ids.substr(0, ids.length - 1); document.getElementById("mcp_PKID").value = ids; }</script>