Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP ASP.NET WebForms Events , +
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 26-Feb-12 22:50pm
Edited 26-Feb-12 22:54pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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();
}
  Permalink  
Comments
vikram_shinde at 27-Feb-12 5:32am
   
it's working now..... many thanks for helping novice like me :)
vikram_shinde at 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.......
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 490
1 Gihan Liyanage 338
2 ChauhanAjay 180
3 Vinay Mistry 160
4 Sergey Alexandrovich Kryukov 138
0 Sergey Alexandrovich Kryukov 9,011
1 OriginalGriff 7,941
2 CPallini 2,603
3 Richard MacCutchan 2,121
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 27 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100