Easy .NET Learning

Wednesday, 13 May 2015

Default value in ddl



After data-binding, do this:
ddlColor.Items.Insert(0, new ListItem("Select","NA")

You should probably add a RequiredFieldValidator control and set its InitialValue to "NA".
<asp:RequiredFieldValidator .. ControlToValidate="ddlColor" InitialValue="NA" />

Posted by Divya Anoop at 22:57
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

About Me

Divya Anoop
View my complete profile

Blog Archive

  • ▼  2015 (59)
    • ►  August (6)
    • ►  July (24)
    • ►  June (10)
    • ▼  May (14)
      • Update Particular Record in Entity Framework
      • Edit Gridview in entity framework
      • INSERT IN TO A SUBTABLE IN DATABASE
      • INSERT IN TO DATABASE IN ENTITY FRAMEWORK
      • Master Page in ASP.NET
      • Edit in Gridview
      • Gridview in ASP.NET
      • Default value in ddl
      • Dynamic Binding to Dropdownlist in ASP.NET
      • CONNECTION CLASS IN ASP.NET
      • Dynamic Binding Country,State and District in ASP.NET
      • Stop comboBox's selectedIndexChanged event from fi...
      • FETCH USING SQL DATA READER
      • DYNAMIC BINDING TO COMBOBOX IN WINDOWS FORMS
    • ►  April (5)
Simple theme. Theme images by gaffera. Powered by Blogger.