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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web User Control - Variable Values

Status
Not open for further replies.

adalli

Programmer
Feb 8, 2005
44
MT
Hi,

I created a Web User Control with just a dropdown, listing a number of countries. One of the properties is DefaultValue to which I would like send a country to be displayed.

If I remove the quotes from strCountry, I get the error "Attribute values must be enclosed in quotation marks"


Dim strCountry as String = "Country 1".

<CountriesDropDown:CountriesDropDown ID="ddCountry" runat="server"
Width="216"
IsReadOnly ="false"
DefaultValue=strCountry
/>

Can anyone please help?

Thanks

 
DefaultValue is not a property of the dropdownlist.
You need to do this in your code behind.:
Code:
Dim strCountry as String = "Country 1"
DropDownList1.SelectedValue = strCountry
OR this:
DropDownList1.Items.FindByValue(strCountry ).Selected = True
 

Yes you are right. I created DefaultValue as a property in order to be able to set the country value I want to display.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top