如何在asp.net中创建1row到2row GridView?

时间:2015-03-11 08:21:58

标签: asp.net gridview datagridview row datagridviewcolumn

我有GridView这样的5个项目。

enter image description here

我想将此GridView设为以下大红色方块。如何在一个GridView中制作2个单元?

enter image description here

ASP代码:

    <asp:GridView ID="GridView" runat="server" DataSourceID="GridView1" 
    OnRowCreated="GridView1_RowCreated" AutoGenerateColumns="false" EmptyDataText="표시할 내용없음">
        <Columns>
            <asp:BoundField DataField="Seq"/>
            <asp:BoundField DataField="Title" />
            <asp:BoundField DataField="UUSER" />
            <asp:BoundField DataField="NoticeDate" />
            <asp:BoundField DataField="SCnt" />
        </Columns>
    </asp:GridView>

C#

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.Header)
    {
        e.Row.Cells[0].Visible = false;
        e.Row.Cells[1].Visible = false;
        e.Row.Cells[2].Visible = false;
        e.Row.Cells[3].Visible = false;
        e.Row.Cells[4].Visible = false;
        //e.Row.Cells[1].Attributes.Add("colspan", "2");
    }

0 个答案:

没有答案