Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# ASP.NET MVC Forms Finishing Our CRUD Web App Using TempData

Dan Comperini
PLUS
Dan Comperini
Courses Plus Student 2,215 Points

A better way to show the bootstrap alert

The final 'Using TempData' example should have combined the check for null data with the dismissable alert. As coded, a null message will display an empty button on the screen.

@if (TempData["Message"] != null)
{
    <div class="alert alert-success alert-dismissible" role="alert">
        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
            <span aria-hidden="true">&times;</span>
        </button>
        @TempData["Message"]
    </div>
}
Steven Parker
Steven Parker
231,268 Points

It's not clear if you are asking a question here.

Or are you sharing something you discovered? Please elaborate a bit more.

And be sure to format your code using the instructions from the Markdown Cheatsheet found below the "Add an Answer" area :arrow_heading_down:

1 Answer

James Churchill
STAFF
James Churchill
Treehouse Teacher

Dan,

Thanks for taking the time to provide feedback on the course!

The code that you provided above looks like what was shown in the video. Maybe I'm overlooking something?

Thanks ~James