Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project, I need to get the listview containing the data from the back end, If I place the listview in the form and upon clicking a button I can load data, but the requirement is initially the listview should be hidden or not present there, only on clicking the button the listview should be viewed with data. Thank you.
Posted
Comments
Priyanka Bhagwat 4-Sep-13 4:52am    
on front end set the property to Visible ="false"
and then on button click write
list1.visible=true
karthik reddy mereddy 4-Sep-13 5:09am    
Thank you, I did the same, It worked.
Priyanka Bhagwat 4-Sep-13 5:12am    
for any control you need to hide/show you can use this method!!!!!
Happy Coding :)

At design time set the ListView's Visible property to False.

On button click event use the below to make the list visible.
ListVW.Visible = true;
 
Share this answer
 
v3
Comments
karthik reddy mereddy 4-Sep-13 5:07am    
Thank you, it worked.
I have Set the List View's property Visible = Falsein the properity window.

Within the button click event handler set it to true;

listView1.Visible = true;
[no name] 4-Sep-13 7:22am    
Nice!
Here's a example of the code:

C#
public Form1()
        {
            InitializeComponent();
            //Set the listView Visible property to false
            listView1.Visible = false;
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            //Set the listView Visible property to true
            listView1.Visible = true;
            //Add data
            listView1.Items.Add("one");
        }
 
Share this answer
 
CSS
Set the List View's property Visible = Falsein the properity window.

Within the button click event handler set it to true;

listView1.Visible = true;
 
Share this answer
 

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