protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DDCategory.DataSource = Enum.GetValues(typeof(Category)); DDCategory.DataBind(); DDCourse.DataSource = Enum.GetValues(typeof(Course)); DDCourse.DataBind(); } }
public void Bound_Type() { string con1 = System.Configuration.ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; SqlConnection conn = new SqlConnection(con1); SqlCommand cmd = new SqlCommand(@"select * from Procut_Catagories", conn); conn.Open(); DDCategory.DataSource = cmd.ExecuteReader(); DDCategory.DataTextField = "pcat_name"; DDCategory.DataValueField = "pcat_id"; DDCategory.DataBind(); conn.Close(); conn.Dispose(); }