• FineUI 选中多行获取行ID


     http://www.fineui.com/bbs/forum.php?mod=viewthread&tid=2506&page=1

    /// <summary>
            /// 选中的行
            /// </summary>
            /// <param name="grid"></param>
            /// <returns></returns>
            protected string HowManyRowsAreSelected(Grid grid)
            {
                StringBuilder sb = new StringBuilder();
                int selectedCount = grid.SelectedRowIndexArray.Length;
                if (selectedCount > 0)
                {
                    sb.AppendFormat("共选中了 {0} 行:", selectedCount);
                    sb.Append("<table class="result">");

                    sb.Append("<tr><th>行号</th>");
                    foreach (string datakey in grid.DataKeyNames)
                    {
                        sb.AppendFormat("<th>{0}</th>", datakey);
                    }
                    sb.Append("</tr>");


                    for (int i = 0; i < selectedCount; i++)
                    {
                        int rowIndex = grid.SelectedRowIndexArray[i];
                        sb.Append("<tr>");

                        sb.AppendFormat("<td>{0}</td>", rowIndex + 1);

                        // 如果是内存分页,所有分页的数据都存在,rowIndex 就是在全部数据中的顺序,而不是当前页的顺序
                        if (grid.AllowPaging && !grid.IsDatabasePaging)
                        {
                            rowIndex = grid.PageIndex * grid.PageSize + rowIndex;
                        }

                        object[] dataKeys = grid.DataKeys[rowIndex];
                        for (int j = 0; j < dataKeys.Length; j++)
                        {
                            sb.AppendFormat("<td>{0}</td>", dataKeys[j]);
                        }

                        sb.Append("</tr>");
                    }
                    sb.Append("</table>");
                }
                else
                {
                    sb.Append("<strong>没有选中任何一行!</strong>");
                }

                return sb.ToString();
            }

  • 相关阅读:
    自定义能够for each的类,C#,Java,C++,C++/cli的实现方法
    答网友强护灰飞烟灭关于接口的问题
    浅谈C++的this指针
    padding与margin的区别(网上转的)
    啦啦啦 刚注册的,先水一篇~
    直接把页面的table导出到excel表中
    从FTP下载文件带进度条
    C# 从FTP上下载指定文件到本机
    “无法在证书存储区中找到清单签名证书”错误的解决方法
    网页设置不可复制
  • 原文地址:https://www.cnblogs.com/xihong2014/p/4114727.html
Copyright © 2020-2023  润新知