Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted
Updated 26-Feb-12 22:54pm
v2

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
 
Share this answer
 
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();
}
 
Share this answer
 
Comments
vikram_shinde 27-Feb-12 5:32am    
it's working now..... many thanks for helping novice like me :)
vikram_shinde 27-Feb-12 7:21am    
I want to take this application bit further.... When user click on "Show Data" button instead of showing gridview control on same page, the new page window should popup. SO I will get rid of "Hide Data" button... Is it possible to add this functionality.......

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900