如何在gridview标题部分添加按钮控件 [英] how to add button control in gridview header part

查看:88
本文介绍了如何在gridview标题部分添加按钮控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以在asp.net gridveiw控件中添加一个按钮,但是在页面加载时,当用户点击该按钮时,这个网格视图为空,它将显示所有数据。







但按钮在网格视图中是必要的

解决方案

参考 - 动态添加和删除ASP.NET GridView中的行 [ ^ ]。



这里作者使用 FooterTemplate 添加新行 c>在 TemplateField 中。如果你想把它放在Header上,那么将这段代码移到一个 TemplateField HeaderTemplate 中。

can we add a button in asp.net gridveiw control but on page load this gird view is empty when user click on that button it will show all data.



but button is in grid view it is nessary

解决方案

Refer - Dynamically adding and deleting rows from ASP.NET GridView[^].

Here the author has added the Button "Add New Row" on Footer using FooterTemplate inside a TemplateField. As you want to place this at the Header, so move this code inside the HeaderTemplate of one TemplateField.


这篇关于如何在gridview标题部分添加按钮控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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