点滴积累,融会贯通

-----喜欢一切有兴趣的东西

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

        /// <summary>
        /// gridView字符过长截断显示
        /// </summary>
        /// <param name="GV">gridView</param>
        /// <param name="num">字符显示长度</param>
        public static void DataViewShow(GridView GV,int num)
        {
            for (int i = 0; i < GV.Rows.Count; i++)
            {
                for (int j = 0; j < GV.Columns.Count; j++)
                {
                    GV.Rows[i].Cells[j].ToolTip = GV.Rows[i].Cells[j].Text;
                    if ((GV.Rows[i].Cells[j].Text).Length > num)
                    {
                        GV.Rows[i].Cells[j].Text = (GV.Rows[i].Cells[j].Text).Substring(0, num) + "...";
                    }
                }
            }
        }


        /// <summary>
        /// 隐藏gridView中指定的列
        /// </summary>
        /// <param name="GV">gridView</param>
        /// <param name="row">指定的列</param>
        public static void HiddenCol(GridView GV, int row)
        {
            GV.Columns[row].ItemStyle.CssClass = "hidden";
            GV.Columns[row].HeaderStyle.CssClass = "hidden";
            GV.Columns[row].FooterStyle.CssClass = "hidden";
        }

posted on 2007-05-25 16:06  小寒  阅读(1116)  评论(2编辑  收藏  举报