如何在gridview中动态添加页脚行.与文本框

Inn*_*ova 5 c# asp.net gridview footer

如何在gridview中动态添加页脚行.用文本框..请给出任何想法......

Kav*_*han 6

由于网格视图IMO中只能有一个页脚行,因此最好通过将ShowFooter网格视图的属性设置为来添加页脚行true.在FooterStyle这里设置 酒店会很有帮助.

来到编程部分时,

protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.Footer)
    {            
    TextBox txt = new TextBox();
          // set properties of text box
    e.Row.Cells[0].Controls.Add(txt);
    }
}
Run Code Online (Sandbox Code Playgroud)

试试这个并发表评论.

编辑:这将有所帮助 http://www.asp.net/data-access/tutorials/displaying-summary-information-in-the-gridview-s-footer-cs