/// <summary> /// 页面加载 /// </summary> protected void Page_Load(object sender, EventArgs e) { base.moduleID = 103; if (!IsPostBack) { AuthUserOperationPermission(Permission.Add); IList <GameKindItem> list = FacadeManage.aidePlatformFacade.GetGameList(); if (list != null && list.Count > 0) { //ddlKind.DataSource = list; //ddlKind.DataTextField = "KindName"; //ddlKind.DataValueField = "KindID"; //ddlKind.DataBind(); CheckBoxList1.DataSource = list; CheckBoxList1.DataTextField = "KindName"; CheckBoxList1.DataValueField = "KindID"; CheckBoxList1.DataBind(); } if (TypeID <= 0) { GID.Visible = false; GNAME.Visible = false; } else { GID.Visible = true; GNAME.Visible = true; } } }
protected void DropDownList4_SelectedIndexChanged(object sender, EventArgs e) { if (RadioButton1.Checked) { com.CommandText = "select distinct st_fname+' '+st_lname as fullname ,sa.st_id from student s , [st-Act] sa where s.st_id = sa.st_id and Act_id =" + DropDownList4.SelectedValue; com.Connection = con; con.Open(); SqlDataReader dr1 = com.ExecuteReader(); CheckBoxList1.DataSource = dr1; CheckBoxList1.DataTextField = ("fullname"); CheckBoxList1.DataValueField = ("st_id"); CheckBoxList1.DataBind(); con.Close(); } else if (RadioButton2.Checked) { com.CommandText = "select distinct st_fname+' '+st_lname as fullname ,sa.st_id from student s , [st-Act] sa where s.st_id = sa.st_id and s.Dept_id =" + DropDownList3.SelectedValue + " and Act_id =" + DropDownList4.SelectedValue; com.Connection = con; con.Open(); SqlDataReader dr2 = com.ExecuteReader(); // DropDownList4.DataSource = dr2; CheckBoxList1.DataSource = dr2; CheckBoxList1.DataTextField = ("fullname"); CheckBoxList1.DataValueField = ("st_id"); CheckBoxList1.DataBind(); con.Close(); } }
private void LoadPlantName() { try { dtm = DateTime.ParseExact(txt_FromDate.Text, "dd/MM/yyyy", null); dtm1 = DateTime.ParseExact(txt_ToDate.Text, "dd/MM/yyyy", null); string d1 = dtm.ToString("MM/dd/yyyy"); string d2 = dtm1.ToString("MM/dd/yyyy"); ds = null; ds = BllPlant.LoadPlantNameChkLst1(ccode.ToString()); if (ds != null) { CheckBoxList1.DataSource = ds; CheckBoxList1.DataTextField = "Plant_Name"; CheckBoxList1.DataValueField = "plant_Code";//ROUTE_ID CheckBoxList1.DataBind(); } else { } } catch (Exception ex) { } }
// Reset filters protected void Button6_Click(object sender, EventArgs e) { CheckBoxList1.ClearSelection(); CheckBox1.Checked = false; CheckBoxList2.ClearSelection(); ExecuteSearchAndSorting(); }
protected void Page_Init(object sender, EventArgs e) { var _mp = new DlMainpagepopulator(); //get salaries CheckBoxList6.DataSource = _mp.GetSalary(); CheckBoxList6.DataTextField = "sTerm"; CheckBoxList6.DataValueField = "Termid"; CheckBoxList6.DataBind(); //get locations CheckBoxList2.DataSource = _mp.GetLocations(); CheckBoxList2.DataTextField = "sTerm"; CheckBoxList2.DataValueField = "Termid"; CheckBoxList2.DataBind(); //get industry CheckBoxList1.DataSource = _mp.GetIndustries(); CheckBoxList1.DataTextField = "sTerm"; CheckBoxList1.DataValueField = "Termid"; CheckBoxList1.DataBind(); if (Request.QueryString["q"] != null & Request.QueryString["q"] != "all") { TextBox2.Text = Request.QueryString["q"]; } }
protected void Carregar(object sender, EventArgs e) { DataSet ds = new DataSet(); MySqlConnection conn = new MySqlConnection(sc); conn.Open(); string sql = "SELECT * FROM produto ORDER BY nome"; MySqlDataAdapter conversor = new MySqlDataAdapter(sql, conn); conversor.Fill(ds, "tbCliente"); sql = "SELECT * FROM produto WHERE valor < 40 ORDER BY valor DESC"; conversor.SelectCommand = new MySqlCommand(sql, conn); conversor.Fill(ds, "tbPromo"); conn.Close(); CheckBoxList1.DataSource = ds.Tables["tbCliente"]; CheckBoxList1.DataTextField = "nome"; CheckBoxList1.DataBind(); GridView1.DataSource = ds.Tables["tbCliente"]; GridView1.DataBind(); DropDownList1.DataSource = ds.Tables["tbPromo"]; DropDownList1.DataTextField = "valor"; DropDownList1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Context.User.IsInRole("Super Admin")) { Response.Redirect("Access.aspx"); } if (!IsPostBack) { string ServLineName = Request.QueryString["ServLineName"]; ServiceLineName.Text = ServLineName; string ServLineId = Request.QueryString["ID"]; ServiceLineRepository SLRepo = new ServiceLineRepository(); SLRepo.getServLineDetails(ServLineId); SelectAllUsers selectAllUsers = new SelectAllUsers(); SLMcheckList.DataSource = SLRepo.ServLineManTab; SLMcheckList.DataTextField = "UserName"; SLMcheckList.DataValueField = "Id"; SLMcheckList.DataBind(); for (int i = 0; i < SLMcheckList.Items.Count; i++) { SLMcheckList.Items[i].Selected = true; } CheckBoxList1.DataSource = selectAllUsers.getDetails(); CheckBoxList1.DataTextField = "UserName"; CheckBoxList1.DataValueField = "Id"; CheckBoxList1.DataBind(); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { try { con.Open(); string choice = DropDownList1.SelectedItem.Value; string choice1 = DropDownList2.SelectedItem.Value; Label2.Visible = true; SqlDataAdapter adapter; DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand("select * from Subjects where Department = '" + choice + "'and term= '" + choice1 + "'", con); adapter = new SqlDataAdapter(cmd); adapter.Fill(ds); CheckBoxList1.DataSource = ds; CheckBoxList1.DataTextField = "Subject"; CheckBoxList1.DataBind(); foreach (DataRow dr in ds.Tables[0].Rows) { credit.Add(dr["Credit"].ToString()); CourseId.Add(dr["CourseId"].ToString()); } Session["key"] = credit; Session["id"] = CourseId; } catch (Exception ex) { Label1.ForeColor = Color.Red; Label1.Text = ex.Message; } }
protected void btnCad_Click(object sender, EventArgs e) { if (!DropDownList1.SelectedIndex.Equals(0)) { for (int i = 0; i < CheckBoxList1.Items.Count; i++) { if (CheckBoxList1.Items[i].Selected == true) { if (!Roles.IsUserInRole(DropDownList1.SelectedItem.Value, CheckBoxList1.Items[i].Value)) { Roles.AddUserToRole(DropDownList1.SelectedItem.Value, CheckBoxList1.Items[i].Value); } } else { if (Roles.IsUserInRole(DropDownList1.SelectedItem.Value, CheckBoxList1.Items[i].Value)) { Roles.RemoveUserFromRole(DropDownList1.SelectedItem.Value, CheckBoxList1.Items[i].Value); } } } } Response.Write("<script language='javascript'>alert('Alterado o perfil com sucesso!');</script>"); DropDownList1.ClearSelection(); CheckBoxList1.ClearSelection(); }
//private void LoadRouteName1() //{ // try // { // CheckBoxList2.Items.Clear(); // dr = null; // dr = BLroute.getroutmasterdatareader4(companycode.ToString(), plantcode.ToString()); // if (dr.HasRows) // { // while (dr.Read()) // { // CheckBoxList2.Items.Add(dr["Tot_Distance"].ToString() + '_' + dr["ROUTE_ID"].ToString()); // } // } // else // { // } // } // catch (Exception ex) // { // } //} private void LoadRouteName() { try { ds = null; //ds = BLroute.getroutmasterdatareader3(companycode.ToString(), plantcode.ToString()); con = dbaccess.GetConnection(); DataTable DS = new DataTable(); string sqlstr; sqlstr = "select Route_ID,CAST(Route_ID as NVARCHAR)+'_'+Route_Name as Route_Name from Route_Master WHERE status=1 and Company_code='" + companycode + "' AND Plant_code='" + plantcode + "' ORDER BY ROUTE_ID "; SqlCommand cmd = new SqlCommand(sqlstr, con); SqlDataAdapter dsr = new SqlDataAdapter(cmd); rr.Rows.Clear(); dsr.Fill(rr); if (rr.Rows.Count > 0) { CheckBoxList1.DataSource = rr; CheckBoxList1.DataTextField = "ROUTE_NAME"; CheckBoxList1.DataValueField = "ROUTE_ID";//ROUTE_ID CheckBoxList1.DataBind(); } else { } } catch (Exception ex) { } }
protected void EventDateDDL_SelectedIndexChanged(object sender, EventArgs e) { //Selection for event date when displaying activities Console.WriteLine(EventDateDDL.SelectedValue); String sqlQuery = "Select EventID, EventName, EventName + ' ' + convert(nvarchar, convert(nvarchar, Time, 0)) as EventNameTime, Date from Event where Date = '" + EventDateDDL.SelectedValue + "'"; //Get connection string from web.config file string strcon = ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString; //create new sqlconnection and connection to database by using connection string from web.config file SqlConnection con = new SqlConnection(strcon); con.Open(); DataTable dtx = new DataTable(); SqlDataAdapter sqlAdapter = new SqlDataAdapter(sqlQuery, con); sqlAdapter.Fill(dtx); if (dtx.Rows.Count > 0) { CheckBoxList1.DataSource = dtx; CheckBoxList1.DataTextField = "EventNameTime"; CheckBoxList1.DataValueField = "EventID"; CheckBoxList1.DataBind(); } CheckBoxListSelect(); con.Close(); }
protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { PrepareThemeAndModifierOptions(DropDownList1.SelectedValue); RadioButtonList1.ClearSelection(); CheckBoxList1.ClearSelection(); CleanUp(GetMapObj()); }
public void BindDropDownListData() { //SqlConnection con = new SqlConnection("Data Source=RND3 " + "\\" + " SQLEXPRESS;Initial Catalog=SSSolutionFiles;Integrated Security=True"); //SqlConnection mySqlConnection = new SqlConnection(); { try { con.Open(); SqlCommand mySqlCommand = new SqlCommand("Select username from userfile ", con); SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter(mySqlCommand); DataSet myDataSet = new DataSet(); mySqlDataAdapter.Fill(myDataSet); //DropDownList1.DataSource = myDataSet; //DropDownList1.DataTextField = "username"; //DropDownList1.DataValueField = "username"; //DropDownList1.DataBind(); CheckBoxList1.DataSource = myDataSet; CheckBoxList1.DataTextField = "username"; CheckBoxList1.DataValueField = "username"; CheckBoxList1.DataBind(); } catch (Exception ex) { Label1.Text = ex.Message; } finally { con.Close(); } } }
protected void Page_Load(object sender, System.EventArgs e) { string s = Request.Params["UserID"]; userID = int.Parse(Request.Params["UserID"]); currentUser = new User(userID); Label1.Text = "用户: " + currentUser.UserName + " 角色分配"; if (!Page.IsPostBack) { DataSet dsRole = AccountsTool.GetRoleList(); CheckBoxList1.DataSource = dsRole.Tables[0].DefaultView; CheckBoxList1.DataTextField = "Description"; CheckBoxList1.DataValueField = "RoleID"; CheckBoxList1.DataBind(); AccountsPrincipal newUser = new AccountsPrincipal(currentUser.UserName); if (newUser.Roles.Count > 0) { ArrayList roles = newUser.Roles; for (int i = 0; i < roles.Count; i++) { // RoleList.Text += "<li>" + roles[i] + "</li>"; foreach (ListItem item in CheckBoxList1.Items) { if (item.Text == roles[i].ToString()) { item.Selected = true; } } } } } }
protected void Button3_Click(object sender, EventArgs e) { //USe the Azure text analytic service to parse message entered by user and extract key phrases from it and suggest them as tags Label4.Visible = true; Button1.Visible = true; dt = new DataTable(); DataColumn dc = new DataColumn("Suggested Tags"); dt.Columns.Add(dc); DataRow dr1; CheckBoxList1.DataTextField = "Suggested Tags"; if (txtHTMLContext.Text != "") { var client = new TextAnalyticsClient(endpoint, credentials); var response = client.ExtractKeyPhrases(txtHTMLContext.Text); foreach (string keyphrase in response.Value) { dr1 = dt.NewRow(); dr1[0] = keyphrase; dt.Rows.Add(dr1); CheckBoxList1.DataSource = dt; CheckBoxList1.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["indirim"] != null) { h1Baslik.InnerText = Session["indirim"].ToString(); } //Cookie OKUMA //if (Request.Cookies["MyCookie"] != null) //{ // HttpCookie kukim = Request.Cookies["MyCookie"]; // LabelAd.Text = kukim["Ad"]; // LabelSepet.Text = kukim["Sepet"]; //} if (Request.Cookies["MyCookie"] != null) { LabelAd.Text = Request.Cookies["MyCookie"]["Ad"]; LabelSepet.Text = Request.Cookies["MyCookie"]["Sepet"]; } if (IsPostBack == false)// if(!IsPostBack) { CheckBoxList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList(); CheckBoxList1.DataBind(); RadioButtonList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList(); RadioButtonList1.DataBind(); DropDownList1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList(); DropDownList1.DataBind(); GridView1.DataSource = repoBrand.GetAll().OrderBy(o => o.Name).ToList(); GridView1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { lblmsg.Text = ""; if (Page.IsPostBack == false) { BDT = BAdapter.SelectBranch(); //drpbranch.DataSource = BDT; //drpbranch.DataTextField = "Branchname"; //drpbranch.DataValueField = "Branchid"; //drpbranch.DataBind(); //drpbranch.Items.Insert(0, "SELECT"); CheckBoxList1.DataSource = BDT; CheckBoxList1.DataTextField = "Branchname"; CheckBoxList1.DataValueField = "branchid"; CheckBoxList1.DataBind(); PubDT = PubAdapter.Select(); drppublication.DataSource = PubDT; drppublication.DataTextField = "Publication"; drppublication.DataValueField = "pid"; drppublication.DataBind(); drppublication.Items.Insert(0, "SELECT"); } }
public void bindept() { try { int count = 0; ds2.Dispose(); ds2.Reset(); ds2 = d2.loaddepartment(ddlcollege.SelectedValue.ToString()); CheckBoxList1.DataSource = ds2; CheckBoxList1.DataTextField = "dept_name"; CheckBoxList1.DataValueField = "Dept_Code"; CheckBoxList1.DataBind(); for (int i = 0; i < CheckBoxList1.Items.Count; i++) { CheckBoxList1.Items[i].Selected = true; if (CheckBoxList1.Items[i].Selected == true) { count += 1; } if (CheckBoxList1.Items.Count == count) { CheckBox1.Checked = true; } } } catch { } }
public void filldata() { admin ad = new admin(); DataTable dt = category.fillcategory(); if (dt.Rows.Count == 0) { } else { CheckBoxList1.DataSource = dt; CheckBoxList1.DataTextField = dt.Columns["category"].ToString(); CheckBoxList1.DataValueField = dt.Columns["id"].ToString(); CheckBoxList1.DataBind(); for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["visible"].ToString() == "1") { CheckBoxList1.Items[i].Selected = true; } else { CheckBoxList1.Items[i].Selected = false; } } } }
protected override void OnPreRender(EventArgs e) { if (!IsPostBack) { string[] colAlias = SampleConstants.BoundDataColumns; ArrayList ThemeList = new ArrayList(); ThemesAndModifiers.FillThemeNames(ThemeList); DropDownList1.Items.Clear(); DropDownList1.DataSource = ThemeList; DropDownList1.DataBind(); // Prepare CheckBoxes, RadioButtons and note label contents. CheckBoxList1.DataSource = colAlias; CheckBoxList1.DataBind(); CheckBoxList1.Visible = this.IsCheckBoxListVisible(ThemeList[0] as string); RadioButtonList1.DataSource = colAlias; RadioButtonList1.DataBind(); RadioButtonList1.Visible = this.IsRadioButtonListVisible(ThemeList[0] as string); Label2.Visible = this.IsNoteLabelVisible(ThemeList[0] as string); Label2.Text = "Please select two columns from below checkboxes."; DropDownList1.Items.Clear(); DropDownList1.DataSource = ThemeList; DropDownList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataSet ds = new DataSet(); string Path = Server.MapPath("~/App.xml"); ds.ReadXml(Path); DropDownList1.DataSource = ds.Tables[0]; DropDownList1.DataTextField = "Name"; DropDownList1.DataValueField = "Id"; DropDownList1.DataBind(); RadioButtonList1.DataSource = ds.Tables[0]; RadioButtonList1.DataTextField = "Name"; RadioButtonList1.DataValueField = "Id"; RadioButtonList1.DataBind(); ListBox1.DataSource = ds.Tables[0]; ListBox1.DataTextField = "Name"; ListBox1.DataValueField = "Id"; ListBox1.DataBind(); CheckBoxList1.DataSource = ds.Tables[0]; CheckBoxList1.DataTextField = "Name"; CheckBoxList1.DataValueField = "Id"; CheckBoxList1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if ((Session[MasterPage.User] as Users)?.Rigths != 2) { Response.Redirect("login.aspx"); } if (IsPostBack) { return; } using (var context = new MainEntities()) { CheckBoxList1.DataSourceID = ""; CheckBoxList2.DataSourceID = ""; var source1 = context.Актеры.ToList(); var source2 = context.Персонажи.ToList(); CheckBoxList1.DataSource = source1.Select(o => $"{o.Имя} {o.Фамилия}").ToList(); CheckBoxList2.DataSource = source2.Select(o => $"{o.Имя} {o.Фамилия}").ToList(); CheckBoxList1.DataBind(); CheckBoxList2.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { con.Open(); TextBox1.Visible = false; Disp(); int count = Convert.ToInt32(TextBox1.Text); GridView1.Visible = false; for (int i = 0; i < count; i++) { if (con.State == ConnectionState.Closed) { con.Open(); } SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "select prj_name from project"; SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); CheckBoxList1.DataSource = dt; CheckBoxList1.DataBind(); //CheckBoxList1.Text = dt.ToString(); con.Close(); } }
private void CheckBoxListItems() { rootCfg = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/petroneeds"); connection = rootCfg.ConnectionStrings.ConnectionStrings["petroneedsConnectionString2"].ConnectionString.ToString(); con = new SqlConnection(connection); con.ConnectionString = connection; con.Open(); dataset = new DataSet(); comm = new SqlCommand("SELECT MenuName, MenuID, ParentID FROM tbl_WebMenu", con); adapter = new SqlDataAdapter(comm); adapter.Fill(dataset); CheckBoxList1.DataSource = dataset; CheckBoxList1.DataTextField = "MenuName"; CheckBoxList1.DataValueField = "MenuID"; //CheckBoxList1.Items[].FindByValue(0) = "ParentID"; ////CheckBoxList1.SelectedIndex.CompareTo("ParentID"); CheckBoxList1.DataBind(); if (CheckBoxList1.DataValueField.Length == 1) { for (int i = 0; i < CheckBoxList1.Items.Count; i++) { CheckBoxList1.Items[i].Selected = true; } } }
protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "<br>Plant=" + DropDownList1.SelectedValue + "<br>"; for (int i = 0; i < Request.Form.Count; i++) { if (Request.Form.Keys[i].Contains("Check")) { Label1.Text = Label1.Text + "<br> added to Garden=" + Request.Form[i] + "<br>"; try { SqlDataSource objDS = new SqlDataSource(); objDS.ProviderName = System.Configuration.ConfigurationManager.ConnectionStrings["GardenConnectionString"].ProviderName; objDS.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["GardenConnectionString"].ConnectionString; objDS.InsertCommand = "insert into T_Garden_Plant (GardenID_FK, PlantID_FK) values (?,?)"; objDS.InsertParameters.Add("GardenID_FK", Request.Form[i].ToString()); objDS.InsertParameters.Add("PlantID_FK", DropDownList1.SelectedValue); objDS.Insert(); } catch (Exception) { ErrorLabel.Text = "Plant could not be added to Garden, possibly Plant is currrently in chosen Garden."; } } } CheckBoxList1.ClearSelection(); }
protected void Button1_Click(object sender, EventArgs e) { eventsource.InsertParameters["event_title"].DefaultValue = TextBox7.Text.ToUpper().Trim(); eventsource.InsertParameters["event_start_date"].DefaultValue = TextBox10.Text.ToUpper().Trim(); eventsource.InsertParameters["event_end_date"].DefaultValue = TextBox12.Text.ToUpper().Trim(); eventsource.InsertParameters["event_end_time"].DefaultValue = TextBox24.Text.ToUpper().Trim(); eventsource.InsertParameters["event_start_time"].DefaultValue = TextBox11.Text.ToUpper().Trim(); eventsource.InsertParameters["event_place"].DefaultValue = CheckBoxList1.SelectedValue; eventsource.InsertParameters["event_capacity"].DefaultValue = TextBox15.Text.Trim(); eventsource.InsertParameters["multi_day_event"].DefaultValue = RadioButtonList1.SelectedValue; eventsource.InsertParameters["audio_visual"].DefaultValue = RadioButtonList2.SelectedValue; eventsource.InsertParameters["user_id"].DefaultValue = TextBox25.Text.Trim(); eventsource.Insert(); TextBox7.Text = string.Empty; TextBox10.Text = string.Empty; TextBox12.Text = string.Empty; TextBox24.Text = string.Empty; TextBox11.Text = string.Empty; TextBox5.Text = string.Empty; TextBox25.Text = string.Empty; TextBox2.Text = string.Empty; TextBox3.Text = string.Empty; TextBox6.Text = string.Empty; TextBox15.Text = string.Empty; TextBox8.Text = string.Empty; CheckBoxList1.ClearSelection(); RadioButtonList1.ClearSelection(); RadioButtonList2.ClearSelection(); }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { CheckBoxList1.Visible = true; CheckBoxList1.DataSource = b.callfeetype(); CheckBoxList1.DataTextField = "fee_type"; CheckBoxList1.DataValueField = "ftid"; CheckBoxList1.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { // string cate = ListBox5.SelectedValue.ToString(); Label1.Text = cate; suppliers = ssmanager.findSupplierByCategory(cate); CheckBoxList1.DataSource = suppliers; CheckBoxList1.DataBind(); }
protected void DropDownList3_SelectedIndexChanged(object sender, EventArgs e) { CheckBoxList2.Items.Clear(); mark = Convert.ToInt32(DropDownList3.SelectedValue); Response.Write(Convert.ToString(mark)); CheckBoxList1.Focus(); }
protected void initchecklist() { CheckBoxList1.Items.Clear(); CheckBoxList1.DataSource = c.SelectDept(); CheckBoxList1.DataTextField = "name"; CheckBoxList1.DataValueField = "code"; CheckBoxList1.DataBind(); }