asp.net mvc - How to Show and Hide Div using C# in MVC 2 aspx -


i newbie in doing mvc , got stucked in middle guide me.

i want hide div in view based on controller action.

view code:

<div id="mudetails" runat="server" style="width: 99%; padding-top: 4%"> </div> 

this parent div inside content present.

controller code.

public actionresult index()         {               // div "mudetails" should not apper             return view();         }   public actionresult index(string textbox)         {                // div "mudetails" should apper          } 

in pageload div should not apper when actionresult index(string textbox) action triggerd div should appear.. tried not able find correct solution.

you need return in model indicate whether or not should display. @ simplest:

    public actionresult index()     {           // div "mudetails" should not apper         return view(false);     }      public actionresult index(string textbox)     {        // div "mudetails" should apper        return view(true);     } 

and in view:

    @model bool      @if (model) {         <div id="mudetails" runat="server" style="width: 99%; padding-top: 4%">         </div>     } 

Comments