View Single Post
  #4 (permalink)  
Old October 9th, 2017, 10:30 PM
mrajagopalan mrajagopalan is offline
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2017
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Smile Fixed code issue in Chapter 6

I was able to solve the code issue in Chapter 6 (page 193) by checking for null for Model. This works for /Edit and /Create controllers.

string checkedText = string.Empty;
if (Model != null)
{
checkedText = Model.Hobbies.Contains(hobby)
? "checked"
: string.Empty;
}


http://localhost:64962/UserDemographics/Create
http://localhost:64962/UserDemographics/Edit/1


-Murali.
Reply With Quote