Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all;

I want to add a div to my layout page for only specific view.
Please help!
Thanks
Posted

How you can achieve it, You can add condition before render that tag. For example
C#
@{
    if(ViewBag.ViewName == "test")
    {
        <div class="testcss">Good Morning!!!!!!!!!!!!!!!1</div>
    }
}


If ViewName property of ViewBag object set to "test" from controller then you just render that div block otherwise it will not render.
 
Share this answer
 
Thank you Mr. S. M. Ahasan Habib for your reply.
Actually i used @section and it worked very well.
@section is the best way to adjust shared view.
 
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