Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
How to make div visible & not visible after clicking button in MVC3.
Thanks,
Sampath bejugama.
Posted

1 solution

You can make an ViewData object like ViewData["name"]=true
and on your view you can check for its value true like

C#
@if((bool)ViewData["name"])
{
//make div
}


or
SQL
@if((bool)ViewData["name"] == false)
{
//set style display of div to none
}
 
Share this answer
 
Comments
sampath1750 29-Feb-12 7:10am    
how can i use above code in controller
Syed Salman Raza Zaidi 29-Feb-12 7:19am    
You can set ViewData["name"]= true on controller alternatively you can use a bool property in Model and set it true/false in controller

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