Click here to Skip to main content
15,909,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a simple page.
In that I have taken a ListBox1.

I need to hide it from javascript but on Page_Load event in codebehind file.

How can i do it....?
Posted

Use jQuery makes it very simple!

C#
$(document).ready({
   $("#id_of_listbox").hide();
});


Make sure you've implemented jQuery[^] in your webpage.
 
Share this answer
 
I would recommend hiding it by default (set visible property of the listbox1 in design).
Once you need to show it, make it visible.
 
Share this answer
 
Comments
Prasad131 12-Apr-11 2:32am    
Same i did very first...
but the issue is after setting it to visible=false in design time we cannnot access that control in javascript.

I need to use it further in javascript...!
Hi,

You can also add style for listbox in page load as

ListBox1.Style.Add("display", "none");
 
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