如何在网格视图的页脚中有多个行? [英] How to have a mutiple rows in the footer of the grid view?

查看:57
本文介绍了如何在网格视图的页脚中有多个行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过单击按钮在网格视图的页脚中包含多行?

How i can have more than a single row in the footer of the grid view by clicking a button?

推荐答案

是的.你可以有这样的东西...

Yes. you can have something like this...

<footertemplate>
    <table>
        <tr>
           <td>
            <asp:label id="Label1" runat="server" text="First Row First Control" >

<asp:textbox id="txtbox1" runat="server" text="First Row Second Control" >
            </td>
        </tr>
        <tr>
            <td>
                  <asp:label id="Label2" runat="server" Text="second row first control"> 
  <asp:TextBox id="txtbox2" runat="server" Text="Second row second control"></td></tr></table></footertemplate>


受保护的void GridShow_DataBound(对象发送者,EventArgs e)

//{

//for(int rowIndex = GridShow.Rows.Count-2; rowIndex> == 0; rowIndex--)

//{

//GridViewRow gvRow = GridShow.Rows [rowIndex];

//GridViewRow gvPreviousRow = GridShow.Rows [rowIndex + 1];

//for(int cellCount = 0; cellCount< gvRow.Cells.Count; cellCount ++)

//{

//如果((gvRow.Cells [cellCount] .Text == gvPreviousRow.Cells [cellCount] .Text)

//{

//如果(gvPreviousRow.Cells [cellCount] .RowSpan< 2)

//{

//gvRow.Cells [cellCount] .RowSpan = 2;

//}

//其他

//{

//gvRow.Cells [cellCount] .RowSpan = gvPreviousRow.Cells [cellCount] .RowSpan +1;

//}

//gvPreviousRow.Cells [cellCount] .Visible = false;

//}

//}

//}

//}
protected void GridShow_DataBound(object sender, EventArgs e)

// {

// for (int rowIndex = GridShow.Rows.Count - 2; rowIndex >= 0; rowIndex--)

// {

// GridViewRow gvRow = GridShow.Rows[rowIndex];

// GridViewRow gvPreviousRow = GridShow.Rows[rowIndex + 1];

// for (int cellCount = 0; cellCount < gvRow.Cells.Count; cellCount++)

// {

// if (gvRow.Cells[cellCount].Text == gvPreviousRow.Cells[cellCount].Text)

// {

// if (gvPreviousRow.Cells[cellCount].RowSpan < 2)

// {

// gvRow.Cells[cellCount].RowSpan = 2;

// }

// else

// {

// gvRow.Cells[cellCount].RowSpan = gvPreviousRow.Cells[cellCount].RowSpan + 1;

// }

// gvPreviousRow.Cells[cellCount].Visible = false;

// }

// }

// }

// }


< footertemplate>
< table>
< tr>
< td>
< asp:label id ="Label1" runat =服务器" text =第一行第一控件">

< asp:textbox id ="txtbox1" runat ="server" text =第一行第二个控件">
</td>
</tr>
< tr>
< td>
< asp:label id ="Label2" runat =服务器" Text =第二行第一控件">
< asp:TextBox id ="txtbox2" runat =服务器" Text =第二行第二控件"></td></tr></table></footertemplate>
<footertemplate>
<table>
<tr>
<td>
<asp:label id="Label1" runat="server" text="First Row First Control" >

<asp:textbox id="txtbox1" runat="server" text="First Row Second Control" >
</td>
</tr>
<tr>
<td>
<asp:label id="Label2" runat="server" Text="second row first control">
<asp:TextBox id="txtbox2" runat="server" Text="Second row second control"></td></tr></table></footertemplate>


这篇关于如何在网格视图的页脚中有多个行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆