Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

MVC4 question, displaying data in a grid...

2»

Comments

  • Closed Accounts Posts: 1,143 ✭✭✭LordNorbury


    NoelOC wrote: »
    There a few ways you could do it.

    The fastest and easiest way I would suggest is to add a variable in your ViewModel for the page.
    You could also use a ViewBag instead depending on your ViewModel but it's the same concept.

    Wrap your Fieldset in an @if statement

    @if (ViewBag.Show == true )
    {
    <fieldset.......>
    }

    In your controller set ViewBag.Show = false on the page load and set it to true when your returning the page with data.

    Hope that makes sense.

    This worked a treat, it's hard to get used to working without event handlers and being able to switch visibility on and off I think...


Advertisement