c# - 如何在 gridview 中动态添加页脚行。带文本框

标签 c# asp.net gridview footer

<分区>

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

最佳答案

由于在 GridView IMO 中只能有一个页脚行,因此最好通过将 GridView 的 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);
    }
}

试试这个并发表评论。

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

关于c# - 如何在 gridview 中动态添加页脚行。带文本框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3131448/

相关文章:

c# - 在新构建后保留 Session[] 变量

c# - Javascript 读取 ASP GridVIEW BoundField Column which is visible false

android - 带有 edittext 和 imge 但只有一个按钮的 Gridview

android - 创建类似印度教日历 View 的 View

c# - 遍历后加速数组查找?

c# - 我如何使用 C# 从 tabcontrol 中删除选项卡

c# - 如何获取当前用户的临时文件夹

android - FCM(Firebase 云消息传递)使用 Asp.Net 推送通知

c# - 如何使用一些变量参数从 javascript 函数调用 asp.net C# 函数并从 C# 函数获取字符串返回?

c# - 使用 .load jquery 时执行 C# 代码