Ext Net 1 x Ext Net GridPanel如何后台遍历GridPanel中的数据

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

A:

参见

  1. http://examples.ext.net/#/GridPanel/Selection_Models/Submitting_Values/
  2. http://examples.ext.net/#/GridPanel/Selection_Models/Row_Selection/

要点,前台提取数据,后台解析JSON字符串。

前台:

<Buttons>             <ext:Button runat="server" Text="Submit selection">                 <DirectEvents>                     <Click OnEvent="SubmitSelection">                         <ExtraParams>                             <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOnly : true}))" Mode="Raw" />                         </ExtraParams>                     </Click>                 </DirectEvents>             </ext:Button>         </Buttons>

后台:

protected void SubmitSelection(object sender, DirectEventArgs e) {     string json = e.ExtraParams["Values"];           if (string.IsNullOrEmpty(json))     {         return;     }           //XML will be represent as     //<records>     //   <record><Name>Alcoa Inc</Name><Price>29.01</Price><Change>0.42</Change><PctChange>1.47</PctChange></record>     //        ...       //   <record>...</record>     //</records>     XmlNode xml = JSON.DeserializeXmlNode("{records:{record:" + json + "}}");       foreach (XmlNode row in xml.SelectNodes("records/record"))     {         string name = row.SelectSingleNode("Name").InnerXml;         string price = row.SelectSingleNode("Price").InnerXml;         string change = row.SelectSingleNode("Change").InnerXml;         string pctChange = row.SelectSingleNode("PctChange").InnerXml;                   //handle values     }           List<Company> companies = JSON.Deserialize<List<Company>>(json);       foreach (Company company in companies)     {         string name = company.Name;         double price = company.Price;         double change = company.Change;         double pctChange = company.PctChange;           //handle values     }           Dictionary<string, string>[] companies1 = JSON.Deserialize<Dictionary<string, string>[]>(json);       foreach (Dictionary<string, string> row in companies1)     {         string name = row["Name"];         string price = row["Price"];         string change = row["Change"];         string pctChange = row["PctChange"];           //handle values     }       this.ResourceManager1.AddScript("Ext.Msg.alert('Submitted', 'Please see source code how to handle submitted data');"); }

           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/ffujbcf/article/details/84096607