private void ddlRoom() { DAL mydal = new DAL(conn); DataSet ds = new DataSet(); ds = mydal.ExecuteProcedure("spGetRoomName"); DDLRoom.DataSource = ds; DDLRoom.DataValueField = "RoomID"; DDLRoom.DataTextField = "RoomName"; DDLRoom.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DDLRoom.DataTextField = "RoomName"; DDLRoom.DataValueField = "RoomID"; DDLRoom.DataSource = rpd.GetData("select * from Room"); DDLRoom.DataBind(); } if (!IsPostBack) { DDLMeal.DataTextField = "MealName"; DDLMeal.DataValueField = "MealID"; DDLMeal.DataSource = rpd.GetData("select * from Meal"); DDLMeal.DataBind(); } }