关于GridView的横向合并数据信息

此为asp.net

前端代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Web.WebForm4" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css">
        .model_s {
            width: 90px;

        }
        .model_er {
        width:50px;
        }

        .GridViewStyle {
            border-right: 2px solid #A7A6AA;
            border-bottom: 2px solid #A7A6AA;
            border-left: 2px solid white;
            border-top: 2px solid white;
            padding: 4px;
        }

            .GridViewStyle a {
                color:#0026ff;
            }

        .GridViewHeaderStyle th {
            border-left: 1px solid #000000;
            border-right: 1px solid #000000;
        }

        .GridViewHeaderStyle {
            background-color: #5D7B9D;
            font-weight: bold;
            color: White;
        }

        .GridViewFooterStyle {
            background-color: #5D7B9D;
            /*background-color: #b6ff00;*/
            font-weight: bold;
            color: White;
        }

        .GridViewRowStyle {
            background-color: #F7F6F3;
            color: #333333;
        }

        .GridViewAlternatingRowStyle {
            background-color: #FFFFFF;
            color: #284775;
        }

            .GridViewRowStyle td, .GridViewAlternatingRowStyle td {
                border: 1px solid #000000;
            }

        .GridViewSelectedRowStyle {
            background-color: #E2DED6;
            font-weight: bold;
            color: #333333;
        }

        .GridViewPagerStyle {
            background-color: #284775;
            color: #FFFFFF;
        }

            .GridViewPagerStyle table /* to center the paging links*/ {
                margin: 0 auto 0 auto;
            }

        #set_ms {
            width: 1000px;
            border: 0px solid #000000;
            margin: 0 auto;
        }

        #sss {
            width: 900px;
            border: 1px solid #000000;
            margin: 100px auto;
        }
        .modd {
        float:right;
        }
        .user_s {
        display:none;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">

        <div id="sss" style="display:block">
            <asp:GridView ID="GrvInfo1" runat="server" AutoGenerateColumns="False" OnDataBound="GrvInfo1_DataBound"
                        OnRowCreated="GrvInfo1_RowCreated" CssClass="GridViewStyle" OnRowDataBound="GrvInfo1_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="序号" SortExpression="stu1" ItemStyle-CssClass="model_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu1" runat="server" Text=‘<%# Eval("stu1") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="组别" SortExpression="stu2" ItemStyle-CssClass="model_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu2" runat="server" Text=‘<%# Eval("stu2") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="姓名" SortExpression="stu3" ItemStyle-CssClass="model_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu3" runat="server" Text=‘<%# Eval("stu3") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="一" SortExpression="stu4_1">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_1" runat="server" Text=‘<%# Eval("stu4_1") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="二" SortExpression="stu4_2">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_2" runat="server" Text=‘<%# Eval("stu4_2") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="三" SortExpression="stu4_3">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_3" runat="server" Text=‘<%# Eval("stu4_3") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="四" SortExpression="stu4_4">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_4" runat="server" Text=‘<%# Eval("stu4_4") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="五" SortExpression="stu4_5">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_5" runat="server" Text=‘<%# Eval("stu4_5") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="六" SortExpression="stu4_6" ItemStyle-CssClass="model_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_6" runat="server" Text=‘<%# Eval("stu4_6") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="日" SortExpression="stu4_7" ItemStyle-CssClass="model_s">
                                <ItemTemplate>
                                    <asp:Label ID="lblstu4_7" runat="server" Text=‘<%# Eval("stu4_7") %>‘></asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle CssClass="GridViewFooterStyle" />
                        <RowStyle CssClass="GridViewRowStyle" />
                        <SelectedRowStyle CssClass="GridViewSelectedRowStyle" />
                        <PagerStyle CssClass="GridViewPagerStyle" />
                        <AlternatingRowStyle CssClass="GridViewAlternatingRowStyle" />
                        <HeaderStyle CssClass="GridViewHeaderStyle" />
                    </asp:GridView>
        </div>
    </form>
    <script type="text/javascript">
        var _oldColor;
        function SetNewColor(source)
        { _oldColor = source.style.backgroundColor; source.style.backgroundColor = ‘#999999‘; }
        function SetOldColor(source)
        { source.style.backgroundColor = _oldColor; }
    </script>
</body>
</html>

  

后端代码:

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                this.GrvInfo1.DataSource = new List<ste_ff>()
                {
                new ste_ff(){stu1="1",stu2="南区部",stu3="纪文义",stu4_1="牵头南区工作",stu4_2="牵头南区工作",stu4_3="牵头南区工作",stu4_4="牵头南区工作",stu4_5="牵头南区工作",stu4_6="休息",stu4_7="休息" },
                new ste_ff(){stu1="2",stu2="南区部",stu3="纪文义1",stu4_1="水泵状态建设",stu4_2="水泵状态建设",stu4_3="水泵状态建设",stu4_4="付款督办",stu4_5="付款督办",stu4_6="休息",stu4_7="休息"},
                new ste_ff(){stu1="3",stu2="中区部",stu3="纪文义2",stu4_1="双月会准备1",stu4_2="双月会准备2",stu4_3="双月会准备2",stu4_4="制度文库修订汇报",stu4_5="制度文库修订汇报",stu4_6="休息",stu4_7="休息"},
                new ste_ff(){stu1="4",stu2="中区部",stu3="纪文义3",stu4_1="培训课件审核汇报",stu4_2="培训课件审核汇报",stu4_3="培训课件审核汇报",stu4_4="培训课件审核汇报",stu4_5="培训课件审核汇报",stu4_6="休息",stu4_7="休息"},
                new ste_ff(){stu1="5",stu2="北区部",stu3="纪文义4",stu4_1="牵头南区工作1",stu4_2="牵头南区工作1",stu4_3="牵头南区工作",stu4_4="牵头南区工作",stu4_5="牵头南区工作",stu4_6="休息",stu4_7="休息"},
                };
                this.GrvInfo1.DataBind();
            }
        }
#region 下周计划
        protected void GrvInfo1_DataBound(object sender, EventArgs e)
        {
            //合并行
            CommonClass_s.UnitRow_s(GrvInfo1, 1, "lblstu2");
            //合并列
            CommonClass_s.UnitCell_s(GrvInfo1, 3, "lblstu4_1", "lblstu4_2", "lblstu4_3", "lblstu4_4", "lblstu4_5");
        }

        public class CommonClass_s
        {
            #region 合并行(相同值)-普通列

            /// <summary>
            /// 合并行(普通列)
            /// </summary>
            /// <param name=“gv”>所对应的GridView对象</param>
            /// <param name=“columnIndex”>所对应要合并的列的索引</param>
            public static void UnitRow_s(GridView gv, int columnIndex)
            {
                int i;
                string lastType;
                int lastCell;
                if (gv.Rows.Count > 0)
                {
                    lastType = gv.Rows[0].Cells[columnIndex].Text;
                    gv.Rows[0].Cells[columnIndex].RowSpan = 1;
                    lastCell = 0;
                    for (i = 1; i < gv.Rows.Count; i++)
                    {
                        if (gv.Rows[i].Cells[columnIndex].Text == lastType)
                        {
                            gv.Rows[i].Cells[columnIndex].Visible = false;
                            gv.Rows[lastCell].Cells[columnIndex].RowSpan++;
                        }
                        else
                        {
                            lastType = gv.Rows[i].Cells[columnIndex].Text;
                            lastCell = i;
                            gv.Rows[i].Cells[columnIndex].RowSpan = 1;
                        }
                    }
                }
            }

            #endregion

            #region 合并行(相同值)-模板列

            /// <summary>
            /// 合并行(模板列)
            /// </summary>
            /// <param name=“gv”>所对应的GridView对象</param>
            /// <param name=“columnIndex”>所对应要合并的列的索引</param>  
            /// <param name=“lblName”>模板列里面Lable的Id</param>
            public static void UnitRow_s(GridView gv, int columnIndex, string lblName)
            {
                int i;
                string lastType;
                int lastCell;
                if (gv.Rows.Count > 0)
                {
                    lastType = (gv.Rows[0].Cells[columnIndex].FindControl(lblName) as Label).Text;
                    gv.Rows[0].Cells[columnIndex].RowSpan = 1;
                    lastCell = 0;
                    for (i = 1; i < gv.Rows.Count; i++)
                    {
                        if ((gv.Rows[i].Cells[columnIndex].FindControl(lblName) as Label).Text == lastType)
                        {
                            gv.Rows[i].Cells[columnIndex].Visible = false;
                            gv.Rows[lastCell].Cells[columnIndex].RowSpan++;
                        }
                        else
                        {
                            lastType = (gv.Rows[i].Cells[columnIndex].FindControl(lblName) as Label).Text;
                            lastCell = i;
                            gv.Rows[i].Cells[columnIndex].RowSpan = 1;
                        }
                    }
                }
            }

            #endregion

            #region 合并列(相同值)-普通列

            /// <summary>
            /// 合并列(普通列)
            /// </summary>
            /// <param name="gv">所对应的GridView对象</param>
            /// <param name="columnIndex">所对应要合并的列的索引</param>
            public static void UnitCell_s(GridView gv, int columnIndex)
            {
                int i;
                string lastType;
                if (gv.Rows.Count > 0)
                {
                    for (i = 1; i < gv.Rows.Count; i++)
                    {
                        lastType = gv.Rows[i].Cells[columnIndex].Text;
                        gv.Rows[i].Cells[columnIndex].ColumnSpan = 1;
                        if (gv.Rows[i].Cells[columnIndex + 1].Text == lastType)
                        {
                            gv.Rows[i].Cells[columnIndex + 1].Visible = false;
                            gv.Rows[i].Cells[columnIndex].ColumnSpan++;
                        }
                        else
                        {
                            lastType = gv.Rows[i].Cells[columnIndex].Text;
                            gv.Rows[i].Cells[columnIndex].ColumnSpan = 1;
                        }
                    }
                }
            }

            #endregion

            #region 合并列(相同值)-模板列

            /// <summary>
            /// 合并行(模板列)
            /// </summary>
            /// <param name=“gv”>所对应的GridView对象</param>
            /// <param name=“columnIndex”>所对应要合并的列的索引</param>  
            /// <param name=“lblName1”>模板列里面Lable1的Id</param>
            /// /// <param name=“lblName1”>模板列里面Lable2的Id</param>
            public static void UnitCell_s(GridView gv, int columnIndex, string lblName1, string lblName2, string lblName3, string lblName4, string lblName5)
            {
                int i;
                string lastType1;
                string lastType2;
                string lastType3;
                string lastType4;
                string lastType5;
                int num_set = 90;//单表格列的列宽
                if (gv.Rows.Count > 0)
                {
                    for (i = 0; i < gv.Rows.Count; i++)
                    {
                        int models = 1;
                        int mnw = 0;
                        lastType1 = (gv.Rows[i].Cells[columnIndex].FindControl(lblName1) as Label).Text;
                        lastType2 = (gv.Rows[i].Cells[columnIndex + 1].FindControl(lblName2) as Label).Text;
                        lastType3 = (gv.Rows[i].Cells[columnIndex + 2].FindControl(lblName3) as Label).Text;
                        lastType4 = (gv.Rows[i].Cells[columnIndex + 3].FindControl(lblName4) as Label).Text;
                        lastType5 = (gv.Rows[i].Cells[columnIndex + 4].FindControl(lblName5) as Label).Text;
                        string model_r = lastType1 + "," + lastType2 + "," + lastType3 + "," + lastType4 + "," + lastType5;
                        string[] model_uu = model_r.Trim().Split(‘,‘);
                        gv.Rows[i].Cells[columnIndex].ColumnSpan = 1;

                        ///===================

                        if (lastType1 == lastType2)
                        {
                            gv.Rows[i].Cells[columnIndex + 1].Visible = false;
                            gv.Rows[i].Cells[columnIndex].ColumnSpan = 2;
                            gv.Columns[columnIndex].ItemStyle.Width = num_set * 1;
                        }
                        if (lastType2 == lastType3)
                        {
                            gv.Rows[i].Cells[columnIndex + 2].Visible = false;
                            if (lastType1 == lastType3)
                            {
                                gv.Rows[i].Cells[columnIndex].ColumnSpan = 3;
                                gv.Columns[columnIndex].ItemStyle.Width = num_set * 3;
                            }
                            else
                            {
                                gv.Rows[i].Cells[columnIndex + 1].ColumnSpan = 2;
                                gv.Columns[columnIndex + 1].ItemStyle.Width = num_set * 2;
                            }

                        }
                        if (lastType3 == lastType4)
                        {
                            gv.Rows[i].Cells[columnIndex + 3].Visible = false;
                            if (lastType1 == lastType4)
                            {
                                gv.Rows[i].Cells[columnIndex].ColumnSpan = 4;
                                gv.Columns[columnIndex].ItemStyle.Width = num_set * 4;
                            }
                            else
                            {
                                if (lastType2 == lastType4)
                                {
                                    gv.Rows[i].Cells[columnIndex + 1].ColumnSpan = 3;
                                    gv.Columns[columnIndex + 1].ItemStyle.Width = num_set * 3;
                                }
                                else
                                {
                                    gv.Rows[i].Cells[columnIndex + 2].ColumnSpan = 2;
                                    gv.Columns[columnIndex + 2].ItemStyle.Width = num_set * 2;
                                }
                            }
                        }
                        if (lastType4 == lastType5)
                        {
                            gv.Rows[i].Cells[columnIndex + 4].Visible = false;
                            if (lastType1 == lastType5)
                            {
                                gv.Rows[i].Cells[columnIndex].ColumnSpan = 5;
                                gv.Columns[columnIndex].ItemStyle.Width = num_set * 5;
                            }
                            else
                            {
                                if (lastType2 == lastType5)
                                {
                                    gv.Rows[i].Cells[columnIndex + 1].ColumnSpan = 4;
                                    gv.Columns[columnIndex + 1].ItemStyle.Width = num_set * 4;
                                }
                                else
                                {
                                    if (lastType3 == lastType5)
                                    {
                                        gv.Rows[i].Cells[columnIndex + 2].ColumnSpan = 3;
                                        gv.Columns[columnIndex + 2].ItemStyle.Width = num_set * 3;
                                    }
                                    else
                                    {
                                        gv.Rows[i].Cells[columnIndex + 3].ColumnSpan = 2;
                                        gv.Columns[columnIndex + 3].ItemStyle.Width = num_set * 2;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            #endregion
        }

        protected void GrvInfo1_RowCreated(object sender, GridViewRowEventArgs e)
        {
            //获取下周所有日期

            #region 对获取下周日期的特殊转换(获取下周一时间)

            DateTime currentTime = DateTime.Now;
            int week = Convert.ToInt32(currentTime.DayOfWeek);
            week = week == 0 ? 7 : week;
            var start_time_next_week = currentTime.AddDays(1 - week + 7);//下周星期一
            string set_time = start_time_next_week.ToString("yyyy-MM-dd");

            #endregion

            string[] set_num = set_time.Trim().Split(‘-‘);
            int Year_s = 0;//年
            int Month_s = 0;//月
            int Day_s = 0;//日
            Year_s = Convert.ToInt32(set_num[0]);
            Month_s = Convert.ToInt32(set_num[1]);
            Day_s = Convert.ToInt32(set_num[2]);
            DateTime someDay = new DateTime(Year_s, Month_s, Day_s); //此处换成你实际的日期
            int wd = (int)someDay.DayOfWeek;
            string date_time1 = null;//用于接收日期字符

            for (int i = 1 - wd; i < 8 - wd; i++)
            {
                DateTime currentDay = someDay.AddDays(i);
                DateTime dt = DateTime.Parse(currentDay.ToShortDateString());
                date_time1 += dt.Day.ToString() + ",";
            }
            date_time1 = date_time1.Remove(date_time1.Length - 1, 1);
            string[] date_time2 = date_time1.Trim().Split(‘,‘);
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header://行是标题行
                    TableCellCollection personHeader = e.Row.Cells;//标题行的单元格集合
                    personHeader.Clear();//清空

                    //添加一个表头 比如以及表头有三列 那么序号就是 0 1 2
                    personHeader.Add(new TableHeaderCell());
                    personHeader[0].Attributes.Add("rowspan", "2"); //跨2行
                    personHeader[0].Attributes.Add("colspan", "1"); //跨1列
                    personHeader[0].Attributes.Add("bgcolor", "DarkGreen");
                    personHeader[0].Text = "序号";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[1].Attributes.Add("rowspan", "2"); //跨2行
                    personHeader[1].Attributes.Add("colspan", "1"); //跨1列
                    personHeader[1].Attributes.Add("bgcolor", "DarkGreen");
                    personHeader[1].Text = "组别";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[2].Attributes.Add("rowspan", "2"); //跨2行
                    personHeader[2].Attributes.Add("colspan", "1"); //跨1列
                    personHeader[2].Attributes.Add("bgcolor", "DarkGreen");
                    personHeader[2].Text = "姓名";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[3].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[3].Attributes.Add("bgcolor", "green");
                    personHeader[3].Text = "" + date_time2[0] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[4].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[4].Attributes.Add("bgcolor", "green");
                    personHeader[4].Text = "" + date_time2[1] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[5].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[5].Attributes.Add("bgcolor", "green");
                    personHeader[5].Text = "" + date_time2[2] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[6].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[6].Attributes.Add("bgcolor", "green");
                    personHeader[6].Text = "" + date_time2[3] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[7].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[7].Attributes.Add("bgcolor", "green");
                    personHeader[7].Text = "" + date_time2[4] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[8].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[8].Attributes.Add("bgcolor", "green");
                    personHeader[8].Text = "" + date_time2[5] + "";

                    personHeader.Add(new TableHeaderCell());
                    personHeader[9].Attributes.Add("colspan", "1"); //跨3列
                    personHeader[9].Attributes.Add("bgcolor", "green");
                    personHeader[9].Text = "" + date_time2[6] + "</th></tr><tr>";

                    //再添加一个表头
                    personHeader.Add(new TableHeaderCell());
                    personHeader[10].Attributes.Add("bgcolor", "Khaki");
                    personHeader[10].Text = "一";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[11].Attributes.Add("bgcolor", "Khaki");
                    personHeader[11].Text = "二";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[12].Attributes.Add("bgcolor", "Khaki");
                    personHeader[12].Text = "三";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[13].Attributes.Add("bgcolor", "Khaki");
                    personHeader[13].Text = "四";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[14].Attributes.Add("bgcolor", "Khaki");
                    personHeader[14].Text = "五";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[15].Attributes.Add("bgcolor", "Khaki");
                    personHeader[15].Text = "六";
                    personHeader.Add(new TableHeaderCell());
                    personHeader[16].Attributes.Add("bgcolor", "Khaki");
                    personHeader[16].Text = "日";

                    //还可以继续添加
                    //记住不论多少行表头,每个列的序号是一次递增的,而且需要换行 —</th></tr><tr>

                    break;
            }
        }
        #endregion
行颜色渐变 protected void GrvInfo1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {

                e.Row.Attributes.Add("onMouseOver", "SetNewColor(this);");
                e.Row.Attributes.Add("onMouseOut", "SetOldColor(this);");
            }
        }

ste_ff类:

public class ste_ff
    {
        public string stu1 { set; get; }

        public string stu1_1 { set; get; }
        public string stu2 { set; get; }
        public string stu3 { set; get; }
        public string stu4_1 { set; get; }
        public string stu4_2 { set; get; }
        public string stu4_3 { set; get; }
        public string stu4_4 { set; get; }
        public string stu4_5 { set; get; }
        public string stu4_6 { set; get; }
        public string stu4_7 { set; get; }

        public string stu5_1 { set; get; }
        public string stu5_2 { set; get; }
        public string stu5_3 { set; get; }
        public string stu5_4 { set; get; }
        public string stu5_5 { set; get; }
        public string stu5_6 { set; get; }
        public string stu5_7 { set; get; }

        /// <summary>用于接收星期一ID</summary>
        public string stu_ID1 { set; get; }
        /// <summary>用于接收星期二ID</summary>
        public string stu_ID2 { set; get; }
        /// <summary>用于接收星期三ID</summary>
        public string stu_ID3 { set; get; }
        /// <summary>用于接收星期四ID</summary>
        public string stu_ID4 { set; get; }
        /// <summary>用于接收星期五ID</summary>
        public string stu_ID5 { set; get; }
        /// <summary>用于接收星期六ID</summary>
        public string stu_ID6 { set; get; }
        /// <summary>用于接收星期七ID</summary>
        public string stu_ID7 { set; get; }
    }

运行展示:

原文地址:https://www.cnblogs.com/lysouko/p/11764137.html

时间: 2024-11-02 12:14:39

关于GridView的横向合并数据信息的相关文章

datagridview 纵向 横向 合并单元格

datagridview 单元格合并:纵向以及横向合并参考了csdn上不知哪位的代码,具体哪位找不到连接了. 纵向合并: /// <summary> /// 纵向合并,即合并数据项的值 /// </summary> /// <param name="e"></param> private void DrawCellVer(DataGridViewCellPaintingEventArgs e) { if (e.CellStyle.Alig

Android 横向列表GridView 实现横向滚动

Android 横向列表实现,可左右滑动,如下图 1.主界面布局代码:activity_main.xml a.包裹HorizontalScrollView控件是GirdView横向滚动的基本条件b.GirdView外包裹LinearLayout是java代码中参数设置的必要条件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schema

用python+selenium获取北上广深成五地PM2.5数据信息并按空气质量排序

从http://www.pm25.com/shenzhen.html抓取北京,深圳,上海,广州,成都的pm2.5指数,并按照空气质量从优到差排序,保存在txt文档里 #coding=utf-8 from selenium import webdriver from time import sleep class PM: def __init__(self): self.dr = webdriver.Chrome() self.pm25_info = self.get_pm25_info() de

黑客获取数据信息的目的和进攻手段

进入微软.亚马逊,谷歌等美国IT企业工作人才项目,起薪40万,百度搜索(MUMCS) 黑客使用进攻取证获取凭证,如用户名和密码.这些都允许他们访问敏感数据同时能够隐瞒自己的身份,以拖延攻击时被发现的时间并避免暴露自己的行踪.黑客寻找这种以半永久记忆的形式获取存在如 RAM 内存或交换文件中的动态/非静态数据.一旦黑客获得暂时存储在明文中的用户 ID 和密码,他们就可以进入下一个等级的访问,进一步获取资源,如内部网站.文档管理系统和 SharePoint 站点,本文来自网届网. 以下为原文: "一

Magento 切换成中文后没有数据信息解决办法

一款基于Google Closure compiler压缩Js文件插件. 快捷键: Ctrl+Alt+M            当前文件内压缩Js代码(不推荐) Ctrl+Alt+Shift+M   压缩Js并生成压缩文件 *.min.js 安装成功重启,如果报错,在配置里改一个参数,"compiler": "uglify_js", { // the closure compiler adds new lines every 500 characters // fo

还原数据自动管理的一些参数和获得还原数据信息

一.oracle还原数据自动管理的一些参数: 1.oracle 9i之前的一些程序中开发的脚步上包含手动指定回滚段的语句.这样的语句在执行是虽然对最终结果没有影响但是会在控制台报错,对用户的感觉不好.故引入动态参数 UNDO_SUPPRESS_ERRORS那么在自动管理还原数据的模式下手动指定或设置还原段虽然对最终结果没有影响但是不会在控制台报错. alter session set  undo_suppress_errors=true; 2.UNDO_RETENTION该参数决定了为了保证读一

合并数据

SQL Server 2008 引入了一个称为MERGE 的语句,它能在一条语句中根据逻辑条件对数据进行不同的修改操作(INSERT.UPDATE和DELETE).MERGE语句是SQL 标准的一部分,而T-SQL版本的MERGE语句也增加了一些非标准的扩展. 因为MERGE语句是新增的,所以必须使用SQL Server 2008. 使用MERGE语句的好处是:用较少的代码就可以表达需求,提高查询性能,因为它可以更少地访问查询涉及表. MERGE INTO dbo.Customers AS TG

在aspx页动态加载ascx页面内容,给GridView控件绑定数据

在aspx页动态加载ascx页面内容 //加载ascx页面内容Control c1 = this.Page.LoadControl("WebUserControl1.ascx");//绑定到aspx页的PlaceHolder控件上PlaceHolder1.Controls.Add(c1); DataSet ds = SqlServerHelpr.GetDataSet("select * from dbo.Table_1");//给GridView控件绑定数据Grid

VBA从字符串中取出数据信息的函数

作者:iamlaosong 一个简单的函数,从包含有数字信息的字符串中取出这个数据,利用VAL函数将字符串转换为数值,该函数或略数字字符串后面的字母和汉字信息,所以,只要把数字前面的字母和汉字信息去掉就行了. '函数,从字符串"ABC123456.78DEF"中取出数据 Function mydata(mystring As String) As Double Dim i, k As Integer i = 1 k = Len(mystring) Do Until Val(Mid(my