protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string query = "SELECT * FROM Student"; DBConnect db = new DBConnect(); ddStudentSelect.DataSource = db.GetDataSet(query); ddStudentSelect.DataValueField = "StudentID"; ddStudentSelect.DataTextField = "Name"; ddStudentSelect.DataBind(); SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "GetAllCourses"; gvCourses.DataSource = db.GetDataSetUsingCmdObj(command); gvCourses.DataBind(); for(int r = 0; r<gvCourses.Rows.Count; r++) { CheckBox cb; cb = (CheckBox)gvCourses.Rows[r].FindControl("cbSelectCourse"); if (int.Parse(gvCourses.Rows[r].Cells[10].Text) == 0) { cb.Enabled = false; } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string query = "SELECT * FROM Student"; DBConnect db = new DBConnect(); ddStudentSelect.DataSource = db.GetDataSet(query); ddStudentSelect.DataValueField = "StudentID"; ddStudentSelect.DataTextField = "Name"; ddStudentSelect.DataBind(); } }