View Single Post
  #1 (permalink)  
Old March 24th, 2006, 06:42 AM
rit01 rit01 is offline
Friend of Wrox
 
Join Date: Oct 2005
Location: , , United Kingdom.
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Assigning a SelectedValue in a DropDownList

Hi all

How would I assign a SelectedValue to a DropDownList control within the Page_Load event?... I have tried the following line but doesn't seem to like it..

Code:
Dim DDL As DropDownList = FormView1.FindControl("DDLProfile")
DDL.SelectedValue = "1"
The dropdownlist is static as in it isn't bound to a DB table.

The error I get from this is the following:

Quote:
quote:Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Many thanks

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER