protected void showFoodStation(object sender, EventArgs e) { localhost.WebService food = new localhost.WebService(); FoodGrid.DataSource = food.getFoodStation(); FoodGrid.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { Hotel.Text = Session["Hname"] as string; //Debug.Text = "Hi"; if (!IsPostBack) { Hotel.Text = Session["Hname"] as string; int x = Convert.ToInt32(Session["HotelId"]); //Debug.Text = x.ToString()+x.GetType().ToString(); //"SELECT \"food_name\" as \"Food Name\" ,\"menu_type\" as \"Availability\",\"price\" as \"Price(tk)\" FROM FOOD WHERE \"hotel_id\"= " + hotelID; string queryHotel = "SELECT \"food_id\" as \"ID\" ,\"food_name\" as \"Food Name\" ,\"menu_type\" as \"Availability\",\"price\" as \"Price(tk)\" FROM FOOD WHERE \"hotel_id\"= " + x; FoodDataSource.SelectCommand = queryHotel; FoodDataSource.SelectCommandType = SqlDataSourceCommandType.Text; DataView foods = FoodDataSource.Select(DataSourceSelectArguments.Empty) as DataView; FoodGrid.DataSource = foods; FoodGrid.DataSourceID = null; FoodGrid.DataBind(); } /* * if (!IsPostBack) * { * if (Request.QueryString["key"] != null) * { * DropDownListTime.SelectedValue = QueryString["key"]; * } * * BindData(); * * } */ /* * * string queryHotel = "SELECT \"food_name\" ,\"menu_type\" ,\"price\" FROM FOOD WHERE \"hotel_id\"= " + hotelID; * sadf.SelectCommand = queryHotel; * SqlDataSource2.SelectCommandType = SqlDataSourceCommandType.Text; * DataView foods = SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView; * * * DropDownList1.AutoPostBack = true; * DropDownList1.DataSource = deptList; * //DropDownList1.DataSourceID = null; * * DropDownList1.DataTextField = "Deptname"; * DropDownList1.DataValueField = "Deptid"; * DropDownList1.DataBind();*/ }
protected void FillFoodItems(object sender, EventArgs e) { myDAL objmyDAL = new myDAL(); DataTable GetData = new DataTable(); int AdminID = (int)Session["ID"]; objmyDAL.AdminFoodsList(AdminID, ref GetData); FoodGrid.DataSource = GetData; if (GetData.Rows.Count > 0) { FoodGrid.DataBind(); } }
/// <summary> /// Fill record into GridView /// </summary> public void FillGridView() { FoodGrid.DataSource = Get_Food(); FoodGrid.DataBind(); }