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
jothi kumar
1.3k
107
56.3k
fill the textboxes with selecting dropdownlist in mvc
Jul 29 2014 12:58 AM
hi to all,
Here i'm doing dropdown list in mvc application. But now i want textbox/dropdown.Here i attached my code Kindly help me.
Also when you start typing , the drop down should start filtering itself..For example type
Ti
will show only the state starting with Ti. Hope you understand what I mean.
DESCRIPTION:-
Customer is my module. in that module there r so many fields like name,country,state,city.for country state city i want textbox/dropdown. here i attached my code.
in model:-
public DbSet<State> State { get; set; }
in view:-
@Html.DropDownList("State_Name", (IEnumerable<SelectListItem>)ViewData["ViewState"], new { id = "State_Name", @class = "form-control control-text" })
in controller:-
List
<
SelectListItem
>
list = new List
<
SelectListItem
>
(); list.Add(new SelectListItem { Text = "Select Country", Value = "Select Country" });//set default text for DropdownList var cat = (from c in db.Country select c).ToArray();//get data from database using linq for (int i = 0; i
<
cat.Length;
i++)
{
list.Add(new
SelectListItem
{
Text
=
cat[i].Country_Name,
Value
=
cat[i].Country_Cde.ToString()
});
}
ViewData["ViewCountry"]
=
list;
above code i'm using viewdata.i want using model
Reply
Answers (
0
)
Admin Login page
how to display blank image first in asp.net,