单击按钮后显示gridview [英] display gridview after clicking button

查看:84
本文介绍了单击按钮后显示gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储过程.我想开发一个非常简单的asp.net页面,其中只有一个名为显示数据"的按钮.我想将存储过程绑定到此按钮,单击此按钮后,页面应显示gridview数据.

并且如果可能的话,我想实现另一个名为隐藏数据"的按钮,单击该按钮后将隐藏相同的gridview.

I have a stored procedure. I wants to develop a very simple asp.net page in which, there will be only button called "Show Data". I want to bind my stored procedure to this button and after clicking this button the page should show gridview data.

And if possible I want to implement another button named "Hide Data" which will hide same gridview after clicking it.

推荐答案

Within Page Load event
if(!page.IsPostBack)
{
gridviewCtl.Visible=false;


}

within btnShowData event

{
    gridviewCtl.Visible=true;
   bind gridview here.... 
}

within btnHide event

{
     gridviewCtl.Visible=false
    gridviewCtl.DataSource=null;
  gridviewCtl.Bind();
}


对此有一个简单的逻辑.

将两个按钮一个放在另一个上.
上方按钮文本为显示数据"
在此按钮的click事件上,触发存储过程.
使用存储过程中的数据使网格可见.
将显示数据"按钮设置为可见,将隐藏数据"设置为真实.
单击隐藏数据",则使网格可见为假,同时使隐藏数据"按钮为可见.
将显示数据"按钮设为True.

希望你能想到这个主意
There is a simple logic for this.

Place two buttons one above the other.
The Above button text is "Show Data"
On the click event of this button, fire the Stored procedure.
Make the Grid visible with the data from stored procedure.
Make the "Show Data" Button Visible false and "Hide Data" Visible true.
On the click of the "Hide Data", Make the Grid Visible false And also the "Hide Data" Button Visible false.
Make the "Show Data" Button True.

Hope you will get the idea


这篇关于单击按钮后显示gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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