Click here to Skip to main content
15,888,461 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Select query from datetime field Pin
Rhys Gravell8-Nov-10 21:18
professionalRhys Gravell8-Nov-10 21:18 
GeneralRe: Select query from datetime field Pin
treuveni9-Nov-10 3:15
treuveni9-Nov-10 3:15 
GeneralRe: Select query from datetime field Pin
Rhys Gravell9-Nov-10 3:34
professionalRhys Gravell9-Nov-10 3:34 
GeneralRe: Select query from datetime field Pin
treuveni9-Nov-10 3:51
treuveni9-Nov-10 3:51 
QuestionView and textbox Pin
future38396-Nov-10 15:40
future38396-Nov-10 15:40 
AnswerRe: View and textbox Pin
Eddy Vluggen8-Nov-10 9:02
professionalEddy Vluggen8-Nov-10 9:02 
QuestionMVC and Dropdownliast Pin
future38396-Nov-10 15:17
future38396-Nov-10 15:17 
AnswerRe: MVC and Dropdownliast Pin
TweakBird9-Nov-10 7:21
TweakBird9-Nov-10 7:21 
Using the DropDownList Helper

The DropDownList helper renders a drop-down list. In its simplest form, DropDownList takes one parameter, the name of the ViewData key whose value is of type SelectList and that contains the option values for the drop-down list. The MVC framework uses the ModelState property of ViewData to determine the selected value. If the ModelState property is empty, the framework looks for an item whose Selected property is set.

The following example shows markup for the DropDownList helper method.
<%= Html.DropDownList("pets") %>


The following code is a part of an Index action method in which values are added to a List object. The List object is passed to an instance of SelectList, which is then added to the ViewData object.
List<string> petList = <code>new List<string>()</code>;
petList.Add("Dog");
petList.Add("Cat");
petList.Add("Hamster");
petList.Add("Parrot");
petList.Add("Gold fish");
petList.Add("Mountain lion");
petList.Add("Elephant");

ViewData["Pets"] = new SelectList(petList);

Note:**Both the DropDownList and ListBox helpers accept either a SelectList or MultiSelectList object.

have a look on this link Click Here[^]
QuestionAsp.Net Rendering Option Pin
JayKhatri6-Nov-10 9:36
JayKhatri6-Nov-10 9:36 
AnswerRe: Asp.Net Rendering Option Pin
_Erik_6-Nov-10 10:06
_Erik_6-Nov-10 10:06 
QuestionOnClientClick javascript parameter [modified] Pin
C#Coudou5-Nov-10 21:27
C#Coudou5-Nov-10 21:27 
AnswerRe: OnClientClick javascript parameter Pin
Parwej Ahamad6-Nov-10 9:03
professionalParwej Ahamad6-Nov-10 9:03 
GeneralRe: OnClientClick javascript parameter [modified] Pin
C#Coudou7-Nov-10 13:04
C#Coudou7-Nov-10 13:04 
GeneralRe: OnClientClick javascript parameter Pin
C#Coudou7-Nov-10 14:29
C#Coudou7-Nov-10 14:29 
Questionprint a page on windows mobile Pin
behzadcp4-Nov-10 7:15
professionalbehzadcp4-Nov-10 7:15 
AnswerRe: print a page on windows mobile Pin
NeverHeardOfMe4-Nov-10 7:36
NeverHeardOfMe4-Nov-10 7:36 
QuestionCan't see coded web performance test in VS 2010 Pin
jboyd1114-Nov-10 6:12
jboyd1114-Nov-10 6:12 
AnswerRe: Can't see coded web performance test in VS 2010 Pin
jboyd1114-Nov-10 6:36
jboyd1114-Nov-10 6:36 
GeneralRe: Can't see coded web performance test in VS 2010 Pin
NeverHeardOfMe4-Nov-10 6:46
NeverHeardOfMe4-Nov-10 6:46 
GeneralRe: Can't see coded web performance test in VS 2010 Pin
jboyd1114-Nov-10 9:41
jboyd1114-Nov-10 9:41 
QuestionViewstate Error Pin
treuveni4-Nov-10 1:23
treuveni4-Nov-10 1:23 
AnswerRe: Viewstate Error Pin
Keith Barrow4-Nov-10 1:29
professionalKeith Barrow4-Nov-10 1:29 
GeneralRe: Viewstate Error Pin
treuveni4-Nov-10 2:44
treuveni4-Nov-10 2:44 
AnswerRe: Viewstate Error Pin
treuveni6-Nov-10 20:56
treuveni6-Nov-10 20:56 
GeneralMy Vote 1 Pin
Keith Barrow6-Nov-10 22:26
professionalKeith Barrow6-Nov-10 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.