I have a drop down list connected to database, thus it has all the values from DB.
But i want its default value to be "--select one-- " which should not go into db on selection..it should be just shown there and if not selected from drop down list, it should give an error
Saineshwar BageriPosted Jan 28, 2015, 8:21 AM
Jitendra KumarPosted Jan 28, 2015, 8:18 AM
add drop down list default value using this code.
ddlClass.Items.Insert(0, "Select Class");
ddlClass.SelectedItem.Value = "0";
Or
ddlTechnicalGuide.Items.Insert(0, new ListItem("Select", ""));
Saineshwar BageriPosted Jan 28, 2015, 8:15 AM
And on submit button check that selectedindex of dropdown must not be -1