Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,108 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