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
ashok kumar
NA
9
0
Dropdown bind problem at run time...
Dec 31 2010 9:26 AM
hi friends,
Firstly happy New year...
I have been hiiting my head towards this prob for the past 2 hrs ..
My issue is i am trying to display my dropdownlist in my views (MVC Framework)
my viewmodel class contains the following:
public class two
{
List<SelectListItem> items = new List<SelectListItem>();
public List<SelectListItem> getItemsnew()
{
items.Add(new SelectListItem
{
Text = "one",
Value = "1"
});
items.Add(new SelectListItem
{
Text = "two",
Value = "2"
});
return items;
}
}
In my Controller i have the following
two two2 = new two();
List<SelectListItem> items1 = two2.getItemsnew();
SelectList newselectlist = new SelectList(items1);
ViewData["List1"] = newselectlist;
Error here is while running my application
my dropdown gets displayed but not with the specified values insted
I binds "System.Web.Mvc.SelectListItem " in my dropdown!
for both the values...
I even tried to save the Application..
It saves "
System.Web.Mvc.SelectListItem
" in mt Database...
I know its jus a minor error some where..
plz guide me..
thanks in Adv
Ashok.....
Reply
Answers (
1
)
Tab Focus on textchange event
asp.net upgrade site from 2.0 to 4.0