Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems Setting a default Value 1

Status
Not open for further replies.

chuckh70

Programmer
Feb 4, 2004
71
US
I have an if statement to check if something is null,
and if so I want to set the value for example to *

This just a test I was working with.

How do I set the MySelect.Value to *?

Code:
     If MySelect.Value ="" Then 
Response.Write("No Value Present <BR>")
	MySelect.Value=("*") 
response.write ("MySelectValue=" & MySelect.value.tostring) 
     End If
 
I'm assuming that MySelect is a DropDownList server control. You can insert an item using the following:
MySelect.Items.Insert(0,"*")
That line inserts the * as the first item (SelectedIndex 0)
To then select it you would use:
MySelect.SelectedIndex = 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top