• EXT.NET循环取GridPanel数据


    前台代码:

    <ext:Button ID="SubmitSelection" runat="server" Text="遍历数据" Icon="PageWhiteEdit"
    ToolTip="遍历数据">
    <DirectEvents>
    <Click OnEvent="SubmitSelection_Click">
    <ExtraParams>
    <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanelMain}.getRowsValues({selectedOnly : true}))"
    Mode="Raw" />
    </ExtraParams>
    </Click>
    </DirectEvents>
    </ext:Button>

    后台代码

    [DirectMethod]
    protected void SubmitSelection_Click(object sender, Ext.Net.DirectEventArgs e)
    {
    string json = e.ExtraParams["Values"];

    if (string.IsNullOrEmpty(json))
    {
    return;
    }
    //<records><record><DictCode>JQFL</DictCode>
    //<DictName>警情分类</DictName>
    //<DictValue>
    // </DictValue>
    //<IsSystem>true
    // </IsSystem><IsShow>true</IsShow><IsUse>true</IsUse><DisplayOrder>37</DisplayOrder><Creator>开发人员
    // </Creator><CreateTime>2012-03-05T13:59:06</CreateTime><Editor /></record>
    //</records>
    XmlNode xml = JSON.DeserializeXmlNode("{records:{record:" + json + "}}");
    foreach (XmlNode row in xml.SelectNodes("records/record"))
    {
    string DictCode = row.SelectSingleNode("DictCode").InnerXml;
    string DictName = row.SelectSingleNode("DictName").InnerXml;
    string DictValue = row.SelectSingleNode("DictValue").InnerXml;
    string CreateTime = row.SelectSingleNode("CreateTime").InnerXml;
    }

    List<sys_Dict> Dicts = JSON.Deserialize<List<sys_Dict>>(json);
    foreach (sys_Dict Dict in Dicts)
    {
    string name = Dict.DictName;
    }


    Dictionary<string, string>[] Dicts1 = JSON.Deserialize<Dictionary<string, string>[]>(json);

    foreach (Dictionary<string, string> row in Dicts1)
    {
    string name = row["DictName"];
    }

    this.ResourceManagerMain.AddScript("Ext.Msg.alert('Submitted', 'Please see source code how to handle submitted data');");
    }

  • 相关阅读:
    【JAVA零基础入门系列】Day3 Java基本数据类型
    【JAVA零基础入门系列】Day2 Java集成开发环境IDEA
    【JAVA零基础入门系列】Day1 开发环境搭建
    易语言 【寻找文本】命令的bug
    类的进化史
    C++指针类型识别正确姿势
    C++ 编写DLL文件给易语言调用
    C++中的显式类型转化
    CC++ 1A2B小游戏源码
    C语言dll文件的说明以及生成、使用方法
  • 原文地址:https://www.cnblogs.com/leischen/p/2592957.html
Copyright © 2020-2023  润新知