Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to add different room types in a hotel(eg:single ,double) and other related informations. the problem is i need to display the create page itself with all values i entered after submitting the form. How is it possible?

public ActionResult Create(Hotel hotel)
         //inserting Hotel

      if (ModelState.IsValid)
        //code here
   ViewBag.HotelCategoryHotelCategoryId = new SelectList(db.HotelCategories, "HotelCategoryId", "CategoryName", hotel.HotelCategoryHotelCategoryId);

  return View(hotel);

Can anyone help me.I done coding in mvc3 aspx
Updated 13-Sep-11 21:01pm
Prerak Patel 14-Sep-11 3:01am    
Use code block for code segments

1 solution

Your view should populate the fields with the values that are in the properties of the Hotel object, and your controller method should assign those properties before calling the 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