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
Farooque Ali
1.5k
255
242.8k
Dropdown SelectedIndex Item in MVC Application
Sep 7 2010 3:11 AM
I have created in the Dropdown list in the MVC Application.Also I have get the value from by giving thru the function. Question is: If i select the 1st item from the Dropdown menu from the list, i do not want to display the label control in the form. If i select the 2 option from the Dropdown i want to display the Label Control
So i have to write the SelectIndex Method in the application. Please tell me how to write the SelectedIndex Method in the MVC application?
In the Form I have written AddRule.aspx
<%
=
Html.DropDownList(
"gs1"
)%>
In the Controller
ViewData[
"gs1"
] =
new
List
<
SelectListItem
>
{
new
SelectListItem
{
Text =
"Select"
,
Value =
"0"
,
Selected =
false
},
new
SelectListItem
{
Text =
"("
,
Value =
"1"
,
},
new
SelectListItem
{
Text =
")"
,
Value =
"2"
,
}
};
In the Model,
[
Required
]
[
DataType
(
DataType
.Text)]
public
IEnumerable
<
SelectListItem
> gs1 {
get
;
set
; }
Reply
Answers (
1
)
Chat-like TCP communication problem
ASP 4.0 web application deployment