Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HtmlSelect Control
Message
De
12/02/2005 11:22:40
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
HtmlSelect Control
Divers
Thread ID:
00986289
Message ID:
00986289
Vues:
51
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
Répondre
Fil
Voir

Click here to load this message in the networking platform