pkalp
November 16th, 2005, 01:20 AM
Hi All,
I'm new to ASP.NET
I've a form which contains dropdownlist. In dropdownlist, there is an item "Select Name". I also have required field validator to validate. validator property i gave is
InitailValue as "Select Name"
ControlToValidate as the combo box name
ErrorMessage as "Select Name from the list"
I'm adding item in a combo box in the form load. Retrieving from the database and loading it in the sortedlist and adding it in the dropdownlist as follows
SortedList sl=new SortedList();
sl.Add("<---Select Club Name--->","");
for(int i=0;i<dsClub.Tables[0].Rows.Count;++i)
sl.Add(dsClub.Tables[0].Rows[i][1].ToString(),dsClub.Tables[0].Rows[i][0].ToString());
cmbClubName.DataSource=sl;
cmbClubName.DataTextField="Key";
cmbClubName.DataValueField="Value"; cmbClubName.DataBind();
Now when i execute it i don't get error msg when i didn't select any item. Am i wrong? How to validate the combo box?
Please guide me,
pkalp
I'm new to ASP.NET
I've a form which contains dropdownlist. In dropdownlist, there is an item "Select Name". I also have required field validator to validate. validator property i gave is
InitailValue as "Select Name"
ControlToValidate as the combo box name
ErrorMessage as "Select Name from the list"
I'm adding item in a combo box in the form load. Retrieving from the database and loading it in the sortedlist and adding it in the dropdownlist as follows
SortedList sl=new SortedList();
sl.Add("<---Select Club Name--->","");
for(int i=0;i<dsClub.Tables[0].Rows.Count;++i)
sl.Add(dsClub.Tables[0].Rows[i][1].ToString(),dsClub.Tables[0].Rows[i][0].ToString());
cmbClubName.DataSource=sl;
cmbClubName.DataTextField="Key";
cmbClubName.DataValueField="Value"; cmbClubName.DataBind();
Now when i execute it i don't get error msg when i didn't select any item. Am i wrong? How to validate the combo box?
Please guide me,
pkalp