Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HtmlSelect Control
Message
From
12/02/2005 11:22:40
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
HtmlSelect Control
Miscellaneous
Thread ID:
00986289
Message ID:
00986289
Views:
50
Hi All,

I'm populating a HtmlSelect Control with records from a access db however when I want to add a blank item to the start of my HtmlSelect I am having no joy.

I can add a blank item to the end of my HtmlSelect with no problems with the code below.
OleDbConnection objConn = new OleDbConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
string SQL = "SELECT * FROM Directories WHERE Type <> 1 ORDER BY Title ASC;";
OleDbCommand objComm = new OleDbCommand(SQL, objConn);
objConn.Open();
OleDbDataReader objRS = objComm.ExecuteReader(CommandBehavior.CloseConnection);
		
DirectoryID.DataSource = objRS;
DirectoryID.DataTextField = "Title";
DirectoryID.DataValueField = "ID";
DirectoryID.DataBind();
	
ListItem Item = new ListItem(" ", " ");
DirectoryID.Items.Add(Item);
		
objRS.Close();
Could someone please offer assistance on how to add the blank item to the begining on my HtmlSelect control.

Many Thanks,
Tarran
Reply
Map
View

Click here to load this message in the networking platform