TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vishnu sharma
NA
18
847
getting selected Id instead of Name from dropdown
Jul 26 2018 3:00 AM
public partial class EntryTable
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime Date { get; set; }
public long Mobile { get; set; }
public string Email { get; set; }
[Display(Name="City")]
public int CityId { get; set; }
public IEnumerable<SelectListItem> City { get; set; }
[Display(Name="Category")]
public int CategoryId { get; set; }
public IEnumerable<SelectListItem> Category { get; set; }
public string Gender { get; set; }
public string Address { get; set; }
}
//controller
public ActionResult Index()
{
return View(db.EntryTables.ToList());
}
//View
@Html.DisplayNameFor(model => model.Email)
</th>
<th>
@Html.DisplayNameFor(model => model.CityId)
</th>
<th>
@Html.DisplayNameFor(model => model.CategoryId)
</th>
<th>
here i created two dropdowns, one for City and another for Category. My table is showing only Id of selected dropdown istead of Name.
how can i show the name from selected dropdown in the index view table.
Reply
Answers (
4
)
ASP.NET POPUP The Remaining Data in home page
How to create Home page in Asp.net