using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using APNSoft.WebControls;
using System.Xml;
public partial class ComboBox_PopulateDynamically : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Set empty DataSource from XmlDocument
myComboBox.DataSource = new XmlDocument();
myComboBox.DataBind();
//Get elements collection
ComboBoxElementCollection _Elements = myComboBox.Elements;
//Add elements
_Elements.AddItem("AltaVista");
_Elements.AddItem("Google");
_Elements.AddItem("Yahoo");
_Elements.AddSeparator();
_Elements.AddItem("AlltheWeb");
_Elements.AddItem("dmoz");
_Elements.AddItem("Excite");
_Elements.AddItem("GO");
_Elements.AddItem("HotBot");
_Elements.AddItem("MSN");
_Elements.AddItem("Overture");
}
}
|