public void BindCafe() { dsLogin = new DataSet(); dsLogin = obj_Login.GetCafe(out StrError); if (dsLogin.Tables.Count > 0 && dsLogin.Tables[0].Rows.Count > 0) { DDLLoc.DataSource = dsLogin.Tables[0]; DDLLoc.DataTextField = "Cafeteria"; DDLLoc.DataValueField = "CafeteriaId"; DDLLoc.DataBind(); DDLLoc.SelectedIndex = 0; } else { } }
public void GetLocations() { // var empcd = Session["empcode"].ToString(); try { SqlConnection con = new SqlConnection(strcon); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "inCore.dbo.usp_ITAssets_Ins"; cmd.Parameters.AddWithValue("@Flag", "GetITAssets"); var empcd = Convert.ToString(Session["empcode"]); cmd.Parameters.AddWithValue("@empcd", empcd); cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; SqlDataAdapter adpt = new SqlDataAdapter(cmd); cmd.Connection = con; adpt.SelectCommand = cmd; DataSet ds = new DataSet(); adpt.Fill(ds); DDLLoc.DataSource = ds.Tables[0]; DDLLoc.DataTextField = "locationname"; DDLLoc.DataBind(); DDLLoc.Items.Insert(0, new ListItem("SELECT", "")); DDLAtype.DataSource = ds.Tables[1]; DDLAtype.DataTextField = "AssetTypeDesc"; DDLAtype.DataBind(); DDLAtype.Items.Insert(0, new ListItem("SELECT", "")); DDLMdl.DataSource = ds.Tables[2]; DDLMdl.DataTextField = "AssetTypeDesc"; DDLMdl.DataBind(); DDLMdl.Items.Insert(0, new ListItem("SELECT", "")); DDLMake.DataSource = ds.Tables[3]; DDLMake.DataTextField = "AssetTypeDesc"; DDLMake.DataBind(); DDLMake.Items.Insert(0, new ListItem("SELECT", "")); DDLOS.DataSource = ds.Tables[4]; DDLOS.DataTextField = "AssetTypeDesc"; DDLOS.DataBind(); DDLOS.Items.Insert(0, new ListItem("SELECT", "")); DDLOffce.DataSource = ds.Tables[5]; DDLOffce.DataTextField = "AssetTypeDesc"; DDLOffce.DataBind(); DDLOffce.Items.Insert(0, new ListItem("SELECT", "")); DDLRam.DataSource = ds.Tables[6]; DDLRam.DataTextField = "AssetTypeDesc"; DDLRam.DataBind(); DDLRam.Items.Insert(0, new ListItem("SELECT", "")); DDLHD.DataSource = ds.Tables[7]; DDLHD.DataTextField = "AssetTypeDesc"; DDLHD.DataBind(); DDLHD.Items.Insert(0, new ListItem("SELECT", "")); DDLEmp.DataSource = ds.Tables[8]; DDLEmp.DataTextField = "EMPNM"; DDLEmp.DataBind(); DDLEmp.Items.Insert(0, new ListItem("SELECT", "")); } catch (Exception ex) { } }