public string ProcessOtherFile(System.Web.UI.WebControls.FileUpload file, System.Web.UI.WebControls.CheckBox eliminarImagen, string ruta) { string retorno = ""; if (!string.IsNullOrEmpty(file.PostedFile.FileName)) { Random myRandom = new Random(); string xName = myRandom.Next(1, 1000000).ToString(); if (IMFile.GetNameFile(file.PostedFile.FileName).Length > 16) { retorno = xName + "_" + IMFile.GetNameFile(file.PostedFile.FileName).Substring(0, 16) + IMFile.GetExtensionFile(file.PostedFile.FileName); } else { retorno = xName + "_" + IMFile.GetNameFile(file.PostedFile.FileName).Substring(0, IMFile.GetNameFile(file.PostedFile.FileName).Length) + IMFile.GetExtensionFile(file.PostedFile.FileName); } file.PostedFile.SaveAs(Server.MapPath(ruta + retorno)); } if (eliminarImagen != null) { if (eliminarImagen.Checked) { IMFile.Delete(Server.MapPath(ruta + retorno)); retorno = ""; eliminarImagen.Checked = false; eliminarImagen.Visible = false; } } return(retorno); }
protected override void CreateChildControls() { this.ddlServices = new ServiceSelector { ID = "ddlServices" }; var ctlValidator = new StyledCustomValidator(); ctlValidator.ServerValidate += (s, e) => { e.IsValid = !string.IsNullOrWhiteSpace(this.ddlServices.Value); }; this.chkErrorIfNotInstalled = new CheckBox { Text = "Log error if service is not found" }; this.chkStopIfRunning = new CheckBox { Text = "Stop service if it is running" }; this.Controls.Add( new SlimFormField("Service:", this.ddlServices, ctlValidator), new SlimFormField( "Options:", new Div(this.chkErrorIfNotInstalled), new Div(this.chkStopIfRunning) ) ); }
protected void AgregarControles(Label nombreContr, CheckBox chB, TextBox tbox, HiddenField nuevoHidF, Label hrReg, Label observ) { try { PanelConVisita.Controls.Add(new LiteralControl("<tr>")); PanelConVisita.Controls.Add(new LiteralControl("<td>")); PanelConVisita.Controls.Add(nombreContr); PanelConVisita.Controls.Add(new LiteralControl("</td><td>")); PanelConVisita.Controls.Add(new LiteralControl(" ")); PanelConVisita.Controls.Add(new LiteralControl("</td><td>")); if (hrReg == null) { PanelConVisita.Controls.Add(chB); } else { PanelConVisita.Controls.Add(hrReg); } PanelConVisita.Controls.Add(new LiteralControl("</td><td>")); if (hrReg == null) { PanelConVisita.Controls.Add(tbox); } else { PanelConVisita.Controls.Add(observ); } PanelConVisita.Controls.Add(new LiteralControl("</td></tr>")); } catch (Exception ex) { return; } }
public List<CartItem> UpdateCartItems( ) { using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions()) { String cartId = usersShoppingCart.GetCartId(); ShoppingCartActions.ShoppingCartUpdates[] cartUpdates = new ShoppingCartActions.ShoppingCartUpdates[CartList.Rows.Count]; for (int i =0; i < CartList.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(CartList.Rows[i] ); cartUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductID"] ); CheckBox cbRemove = new CheckBox(); cbRemove = (CheckBox) CartList.Rows[i].FindControl( "Remove" ); cartUpdates[i].RemoveItem = cbRemove.Checked; TextBox quantityTextBox = new TextBox(); quantityTextBox =(TextBox) CartList.Rows[i].FindControl("PurchaseQuantity"); cartUpdates[i].PurchaseQuantity =Convert.ToInt16(quantityTextBox.Text.ToString()); } usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates); CartList.DataBind(); lblTotal.Text =String.Format("{0:c}", usersShoppingCart.GetTotal()); return usersShoppingCart.GetCartItems(); } }
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState) { CheckBox child = null; CheckBox box2 = null; if ((((rowState & DataControlRowState.Edit) != DataControlRowState.Normal) && !this.ReadOnly) || ((rowState & DataControlRowState.Insert) != DataControlRowState.Normal)) { CheckBox box3 = new CheckBox { ToolTip = this.HeaderText }; child = box3; if ((this.DataField.Length != 0) && ((rowState & DataControlRowState.Edit) != DataControlRowState.Normal)) { box2 = box3; } } else if (this.DataField.Length != 0) { CheckBox box4 = new CheckBox { Text = this.Text, Enabled = false }; child = box4; box2 = box4; } if (child != null) { cell.Controls.Add(child); } if ((box2 != null) && base.Visible) { box2.DataBinding += new EventHandler(this.OnDataBindField); } }
public static Control GetFieldControl(this SPFieldCalculated calcField) { Control control = null; switch (calcField.OutputType) { case SPFieldType.Number: case SPFieldType.Currency: control = new TextBox() { CssClass = "ms-long" }; break; case SPFieldType.DateTime: DateTimeControl dtcValueDate = new DateTimeControl(); dtcValueDate.DateOnly = (calcField.DateFormat == SPDateTimeFieldFormatType.DateOnly); control = dtcValueDate; break; case SPFieldType.Boolean: control = new CheckBox(); break; default: control = new TextBox() { CssClass = "ms-long" }; break; } return control; }
public List<CartItem> UpdateCartItems() { using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions()) { String cartId = usersShoppingCart.GetCartId(); ShoppingCartActions.ShoppingCartUpdates[] cartUpdates = new ShoppingCartActions.ShoppingCartUpdates[CartList.Rows.Count]; for (int i = 0; i < CartList.Rows.Count; i++) { cartUpdates[i].ProductId = Convert.ToInt32(getDataKeyName(i, "ProductID")); cartUpdates[i].tipo = getDataKeyName(i, "TipoItem"); CheckBox cbRemove = new CheckBox(); cbRemove = (CheckBox)CartList.Rows[i].FindControl("Remove"); cartUpdates[i].RemoveItem = cbRemove.Checked; TextBox quantityTextBox = new TextBox(); quantityTextBox = (TextBox)CartList.Rows[i].FindControl("PurchaseQuantity"); cartUpdates[i].PurchaseQuantity = Convert.ToInt16(quantityTextBox.Text.ToString()); } //actualiza los productos en el carro compras. usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates); GetShoppingCartItems(); lblTotal.Text = String.Format("{0:c}", usersShoppingCart.GetTotal()); mostrarControles(CartList.Rows.Count); return usersShoppingCart.GetCartItems(); } }
/// <summary> /// 当由类实现时,定义子控件和模板所属的 System.Web.UI.Control 对象。然后在内联模板中定义这些子控件 /// </summary> /// <param name="container">要包含内联模板中的控件实例的 System.Web.UI.Control 对象</param> public void InstantiateIn(System.Web.UI.Control container) { switch (m_ControlType) { case ("Label"): Label label = new Label(); label.ID = m_ControlId; label.DataBinding += new EventHandler(control_DataBinding); //label.Width = Unit.Pixel(50); //label.Height = Unit.Pixel(12); container.Controls.Add(label); break; case ("TextBox"): TextBox textBox = new TextBox(); textBox.ID = m_ControlId; textBox.Width = Unit.Pixel(50); textBox.Height = Unit.Pixel(12); textBox.DataBinding += new EventHandler(control_DataBinding); container.Controls.Add(textBox); break; case ("CheckBox"): CheckBox checkBox = new CheckBox(); checkBox.ID = m_ControlId; checkBox.Checked = true; //checkBox.CausesValidation = false; //checkBox.AutoPostBack = true; //checkBox.CheckedChanged += new EventHandler(OnCheckedChanged); container.Controls.Add(checkBox); break; default: break; } }
/// <summary> /// Must create and return the control /// that will show the administration interface /// If none is available returns null /// </summary> public Control GetAdministrationInterface(Style controlStyle) { this._adminTable = new Table(); this._adminTable.ControlStyle.CopyFrom(controlStyle); this._adminTable.Width = Unit.Percentage(100); TableCell cell = new TableCell(); TableRow row = new TableRow(); cell.ColumnSpan = 2; cell.Text = ResourceManager.GetString("NSurveySecurityAddinDescription", this.LanguageCode); row.Cells.Add(cell); this._adminTable.Rows.Add(row); cell = new TableCell(); row = new TableRow(); CheckBox child = new CheckBox(); child.Checked = new Surveys().NSurveyAllowsMultipleSubmissions(this.SurveyId); Label label = new Label(); label.ControlStyle.Font.Bold = true; label.Text = ResourceManager.GetString("MultipleSubmissionsLabel", this.LanguageCode); cell.Width = Unit.Percentage(50); cell.Controls.Add(label); row.Cells.Add(cell); cell = new TableCell(); child.CheckedChanged += new EventHandler(this.OnCheckBoxChange); child.AutoPostBack = true; cell.Controls.Add(child); Unit.Percentage(50); row.Cells.Add(cell); this._adminTable.Rows.Add(row); return this._adminTable; }
protected void createTable() { listShift = BLL.Application.KQ.SchedulingManagement.getShift(); for (int j = 0; j < 6; j++) { TableRow tr = new TableRow(); for (int i = 0; i < 7; i++) { TableCell cell = new TableCell(); Label lb = new Label(); lb.Font.Size = FontUnit.Large; lb.Font.Bold = true; lb.ID = "lb"+j+i; CheckBox cb = new CheckBox(); cb.ID = "cb" +j+ i; DropDownList ddl = new DropDownList(); ddl.ID = "ddl" +j+ i; cell.Controls.Add(lb); cell.Controls.Add(getNewLiteral()); cell.Controls.Add(cb); cell.Controls.Add(getNewLiteral()); cell.Controls.Add(ddl); tr.Cells.Add(cell); } tableMonth.Controls.Add(tr); } }
protected override void CreateChildControls() { this.chkUseCustomProfileXml = new CheckBox() { Text = "Use custom publish settings..." }; var ctlProjectPublishProfileXmlContainer = new Div() { ID = "ctlProjectPublishProfileXmlContainer" }; this.txtProjectPath = new SourceControlFileFolderPicker(); this.txtProjectPublishProfileName = new ValidatingTextBox(); this.txtProjectPublishProfileXml = new ValidatingTextBox() { TextMode = TextBoxMode.MultiLine, Rows = 7 }; ctlProjectPublishProfileXmlContainer.Controls.Add(new Div("Enter custom publish profile XML:"), this.txtProjectPublishProfileXml); this.txtProjectBuildConfiguration = new ValidatingTextBox() { Required = true }; this.txtVisualStudioVersion = new ValidatingTextBox() { DefaultText = "12.0" }; this.txtAdditionalArguments = new ValidatingTextBox(); this.txtUserName = new ValidatingTextBox() { DefaultText = "Inherit credentials from extension configuration" }; this.txtPassword = new PasswordTextBox(); this.Controls.Add( new SlimFormField("Project/Solution file:", this.txtProjectPath), new SlimFormField("Publish profile:", new Div("Profile Name:"), this.txtProjectPublishProfileName, this.chkUseCustomProfileXml, ctlProjectPublishProfileXmlContainer), new SlimFormField("Build configuration:", this.txtProjectBuildConfiguration), new SlimFormField("Visual Studio version:", this.txtVisualStudioVersion) { HelpText = "Visual Studio must be installed in order to publish directly from the command line. Choose " + "the version of Visual Studio that is installed on the selected server in order for Web Deploy to use the " + "appropriate build targets for the installed version. The default is 12.0 (Visual Studio 2013)." }, new SlimFormField("Credentials:", new Div(new Div("Username:"******"Password:"******"Additional MSBuild arguments:", this.txtAdditionalArguments) ); this.Controls.BindVisibility(chkUseCustomProfileXml, ctlProjectPublishProfileXmlContainer); }
public override void InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, int rowIndex) { chkBox = new CheckBox {ID = "chkBool", Enabled = false}; cell.Controls.Add(chkBox); base.InitializeCell(cell, cellType, rowState, rowIndex); }
/// <summary>Creates a checkbox.</summary> /// <param name="container">The container the checkbox will be added to.</param> /// <returns>A checkbox.</returns> protected override Control CreateEditor(Control container) { CheckBox cb = new CheckBox(); cb.Text = CheckBoxText; cb.Checked = DefaultValue; return cb; }
protected override void CreateChildControls() { ddlVersion = new DropDownList(); ddlVersion.Items.Add(new ListItem("(auto detect)", "")); ddlVersion.Items.Add(new ListItem("2.0", "2.0.50727")); ddlVersion.Items.Add(new ListItem("3.5", "3.5")); ddlVersion.Items.Add(new ListItem("4.0", "4.0.30319")); txtVirtualPath = new ValidatingTextBox { Required = true, Text = "/" }; chkUpdatable = new CheckBox { Text = "Allow this precompiled site to be updatable" }; chkFixedNames = new CheckBox { Text = "Use fixed naming and single page assemblies" }; CUtil.Add(this, new FormFieldGroup(".NET Framework Version", "The version of the .NET Framework to use when building this project.", false, new StandardFormField("Version:", ddlVersion) ), new FormFieldGroup("Application Virtual Path", "The virtual path of the application to be compiled.", false, new StandardFormField("Application Virtual Path:", txtVirtualPath) ), new FormFieldGroup("Additional Options", "", true, new StandardFormField("", chkUpdatable), new StandardFormField("", chkFixedNames) ) ); }
protected void btn_Sub_Click(object sender, EventArgs e) { int IDtemp; IDtemp = int.Parse(lb_CtrlId.Text); Core.Business.PageControlList pageCtrlList =CY.Common.Core.Business.PageControlList.Load(IDtemp); pageCtrlList.ControlID = tb_Ctrlname.Text; pageCtrlList.Save(); Core.Business.ControlPermissions.DeleteByCtrlId(IDtemp); for (int i = 0; i < gv_Permissions.Rows.Count; i++) { CheckBox cb = new CheckBox(); cb = (CheckBox)gv_Permissions.Rows[i].FindControl("chk"); if (cb.Checked) { Core.Business.ControlPermissions Ctrlper=new CY.Common.Core.Business.ControlPermissions(); Ctrlper.ControlID=IDtemp; Ctrlper.PermissionsID=int.Parse(gv_Permissions.DataKeys[i].Value.ToString()); Ctrlper.Save(); } } }
public void InstantiateIn(System.Web.UI.Control container) { CheckBox cb = new CheckBox(); cb.ID = ID; cb.Text = Text; container.Controls.Add(cb); }
public List<CartItem> UpdateCartItems() { using (ShoppingCartActions usersShoppingCart = new ShoppingCartActions()) { String cartId = usersShoppingCart.GetCartId(); ShoppingCartActions.ShoppingCartUpdates[] cartUpdates = new ShoppingCartActions.ShoppingCartUpdates[CartList.Rows.Count]; for (int i = 0; i < CartList.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(CartList.Rows[i]); cartUpdates[i].ProductId = Convert.ToInt32(rowValues["ProductID"]); CheckBox cbRemove = new CheckBox(); cbRemove = (CheckBox)CartList.Rows[i].FindControl("Remove"); cartUpdates[i].RemoveItem = cbRemove.Checked; TextBox quantityTextBox = new TextBox(); quantityTextBox = (TextBox)CartList.Rows[i].FindControl("PurchaseQuantity"); cartUpdates[i].PurchaseQuantity = Convert.ToInt16(quantityTextBox.Text.ToString()); if (!usersShoppingCart.CheckAvailability(cartUpdates[i].PurchaseQuantity, cartUpdates[i].ProductId, cartId)) { // Reload the page. string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count()); Response.Redirect(pageUrl + "?Action=stock&id=" + cartUpdates[i].ProductId); } } usersShoppingCart.UpdateShoppingCartDatabase(cartId, cartUpdates); CartList.DataBind(); lblTotal.Text = String.Format("{0:c}", usersShoppingCart.GetTotal()); return usersShoppingCart.GetCartItems(); } }
private void fillOperationsTable() { Operations.Rows.Clear(); foreach (FxCourseOperations operation in TeacherHelper.CourseOperations()) { TableRow operationRow = new TableRow(); TableCell operationCell = new TableCell(); CheckBox operationCheckBox = new CheckBox(); operationCheckBox.Text = operation.Name; operationCheckBox.ID = operation.ID.ToString(); TblPermissions permission = TeacherHelper.GetPermissionForCourse(course, operation); if (permission == null || !permission.CanBeDelagated) { operationCheckBox.Enabled = false; } else { operationCheckBox.Checked = TeacherHelper.AreParentAndChildByCourse(permission, teacher, course); } operationCell.Controls.Add(operationCheckBox); operationRow.Cells.Add(operationCell); Operations.Rows.Add(operationRow); } }
protected override void InitializeSkin(System.Web.UI.Control Skin) { KeyWords=(TextBox)Skin.FindControl("KeyWords"); AllowPsd = (CheckBox)Skin.FindControl("AllowPsd"); IsEnReply = (CheckBox)Skin.FindControl("IsEnReply"); IsIndexShow = (CheckBox)Skin.FindControl("IsIndexShow"); AllowPsd.Attributes.Add("onclick", "AllowPsd()"); TextBox1 = (TextBox)Skin.FindControl("TextBox1"); TextBox2 = (TextBox)Skin.FindControl("TextBox2"); //js把logId写入 CreateTime = (TextBox)Skin.FindControl("CreateTime"); if (!Page.IsPostBack) { CreateTime.Text = DateTime.Now.ToString(); } LogIdTex = (TextBox)Skin.FindControl("LogId");//没有用到啊··· Title = (TextBox)Skin.FindControl("title"); Add = (Button)Skin.FindControl("Add"); AddDraft = (Button)Skin.FindControl("AddDraft"); Cansel = (Button)Skin.FindControl("Cansel"); Editor = (TextBox)Skin.FindControl("txtContent"); LogCategory = (DropDownList)Skin.FindControl("LogCategory"); this.DataBind(); }
protected override WebControl CreateControlInternal(Control container) { //_checkBox = new DnnRadButton {ID = ID + "_CheckBox", ButtonType = RadButtonType.ToggleButton, ToggleType = ButtonToggleType.CheckBox, AutoPostBack = false}; _checkBox = new CheckBox{ ID = ID + "_CheckBox", AutoPostBack = false }; _checkBox.CheckedChanged += CheckedChanged; container.Controls.Add(_checkBox); //Load from ControlState if (!_checkBox.Page.IsPostBack) { } switch (Mode) { case CheckBoxMode.YN: case CheckBoxMode.YesNo: var stringValue = Value as string; if (stringValue != null) { _checkBox.Checked = stringValue.ToUpperInvariant().StartsWith("Y"); } break; default: _checkBox.Checked = Convert.ToBoolean(Value); break; } return _checkBox; }
protected override void CreateChildControls() { this.ddlServices = new ServiceSelector { ID = "ddlServices" }; var ctlServiceValidator = new StyledCustomValidator(); ctlServiceValidator.ServerValidate += (s, e) => { e.IsValid = !string.IsNullOrWhiteSpace(this.ddlServices.Value); }; this.chkWaitForStop = new CheckBox { Text = "Wait until the service stops", Checked = true }; this.chkIgnoreAlreadyStoppedError = new CheckBox { Text = "Do not generate error if service is already stopped", Checked = true }; this.Controls.Add( new SlimFormField("Service:", this.ddlServices, ctlServiceValidator), new SlimFormField( "Options:", new Div(this.chkWaitForStop), new Div(this.chkIgnoreAlreadyStoppedError) ) ); }
protected override void AddedControl(Control control, int index) { base.AddedControl(control, index); if (control is CheckBox) { _UnderlyingCheckbox = (CheckBox)control; } }
protected override void CreateChildControls() { var application = StoredProcs.Applications_GetApplication(this.ApplicationId).Execute().Applications_Extended.FirstOrDefault(); var variableMode = application != null ? application.VariableSupport_Code : Domains.VariableSupportCodes.All; this.txtFileMasks = new ValidatingTextBox { Required = true, TextMode = TextBoxMode.MultiLine, Rows = 5, Text = "*\\AssemblyInfo.cs" }; this.chkRecursive = new CheckBox { Text = "Also search in subdirectories" }; this.txtVersion = new ValidatingTextBox { Required = true, Text = variableMode == Domains.VariableSupportCodes.Old ? "%RELNO%.%BLDNO%" : "$ReleaseNumber.$BuildNumber" }; this.Controls.Add( new SlimFormField("Assembly version files:", this.txtFileMasks) { HelpText = "Use standard BuildMaster file masks (one per line)." }, new SlimFormField("Assembly version:", this.txtVersion), new SlimFormField("Options:", this.chkRecursive) ); }
protected void btn_DEL_Click(object sender, EventArgs e) { for (int i = 0; i < gv_Page.Rows.Count; i++) { CheckBox cb = new CheckBox(); cb = (CheckBox)gv_Page.Rows[i].FindControl("chk"); if (cb.Checked) { int pageid; pageid = int.Parse(gv_Page.DataKeys[i].Value.ToString()); IList<Core.Business.PageControlList> pageCtrlList = Core.Business.PageControlList.GetPageControlList(pageid); for (int j = 0; j < pageCtrlList.Count; j++) { int CtrlId = pageCtrlList[j].Id; Core.Business.ControlPermissions.DeleteByCtrlId(CtrlId); Core.Business.PageControlList pageCtrl = Core.Business.PageControlList.Load(CtrlId); pageCtrl.DeleteOnSave(); pageCtrl.Save(); } Core.Business.PagePermissions.SqlDeletePagePermissionsByPageId(pageid); Core.Business.PageList pagelist=Core.Business.PageList.Load(pageid); pagelist.DeleteOnSave(); pagelist.Save(); } } dataBind(); }
protected override void CreateChildControls() { base.CreateChildControls(); this.txtTeamProject = new ValidatingTextBox() { Required = true }; this.txtBuildDefinition = new ValidatingTextBox() { Required = true }; this.chkWaitForCompletion = new CheckBox() { Text = "Wait until the TFS build completes", Checked = true }; this.chkValidateBuild = new CheckBox() { Text = "Fail if the TFS build does not succeed", Checked = true }; this.chkCreateBuildVariable = new CheckBox() { Text = "Store the TFS build number as $TfsBuildNumber", Checked = true }; this.Controls.Add( new SlimFormField( "Team project:", this.txtTeamProject ), new SlimFormField( "Build definition:", this.txtBuildDefinition ), new SlimFormField( "Options:", new Div(this.chkCreateBuildVariable), new Div(this.chkWaitForCompletion), new Div(this.chkValidateBuild) ) ); }
/// <summary> /// Renders the controls neccessary for prompting user for a new value and adds them to the parentControl /// </summary> /// <param name="value"></param> /// <param name="setValue"></param> /// <returns></returns> public override Control CreateControl( string value, bool setValue ) { CheckBox cb = new CheckBox(); if (setValue) cb.Checked = string.IsNullOrEmpty(value) ? false : System.Boolean.Parse( value ); return cb; }
private void RenderCrossSellCurrent() { foreach (RelatedProducts rp in Product.CrossSellList) { plhCrossSell.Controls.Add(new LiteralControl("<tr><td>")); TextBox txt = new TextBox(); txt.ID = "txtOriginalCrossSell" + rp.AccessoryPartNo; txt.Text = rp.AccessoryPartNo; txt.Visible = false; plhCrossSell.Controls.Add(txt); plhCrossSell.Controls.Add(new LiteralControl(Server.HtmlEncode(rp.AccessoryPartNo))); plhCrossSell.Controls.Add(new LiteralControl("</td><td>")); plhCrossSell.Controls.Add(new LiteralControl(Server.HtmlEncode(rp.AccessoryName))); plhCrossSell.Controls.Add(new LiteralControl("</td><td>")); CheckBox chk = new CheckBox(); chk.ID = "chkOriginalCrossSell" + rp.AccessoryPartNo; chk.Attributes.Add("cid", rp.AccessoryPartNo); plhCrossSell.Controls.Add(chk); plhCrossSell.Controls.Add(new LiteralControl("</td></tr>")); } }
/// <summary> /// Remove the user being chosen /// by the user drop down list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void RemoveDepartmentButton_Click(object sender, EventArgs e) { HalonModels.Department[] removeList = new HalonModels.Department[DeptList.Rows.Count]; for (int i = 0; i < DeptList.Rows.Count; i++) { IOrderedDictionary rowValues = new OrderedDictionary(); rowValues = GetValues(DeptList.Rows[i]); int tempID = Convert.ToInt32(rowValues["Dept_ID"]); CheckBox cbRemove = new CheckBox(); cbRemove = (CheckBox)DeptList.Rows[i].FindControl("RemoveDept"); if (cbRemove.Checked) { var myItem = (from c in db.Departments where c.Dept_ID == tempID select c).FirstOrDefault(); if (myItem != null) { //Remove all related items to this department first //then remove the department db.Departments.Remove(myItem); db.SaveChanges(); // Reload the page. string pageUrl = Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.Count() - Request.Url.Query.Count()); Response.Redirect(pageUrl + "?DepartmentAction=remove"); } else { LabelRemoveStatus.Text = "Unable to locate Department."; } } } }
private void PopulateOptions() { ParleyOptions options = ParleyOptions.ForParley(_parley); string spacer = string.Empty; for (int loop = 0; loop < options.Count; loop++) { spacer += " <br/>"; } this.LiteralOptionsSpacer.Text = spacer; string currencyCode = _parley.Organization.DefaultCountry.Currency.Code; CheckBox boxAttendance = new CheckBox(); boxAttendance.Text = "Attendance, " + currencyCode + " " + (_parley.AttendanceFeeCents/100).ToString(); boxAttendance.Checked = true; boxAttendance.Enabled = false; boxAttendance.ID = "CheckOptionAttendance"; this.PlaceholderOptions.Controls.Add(boxAttendance); this.PlaceholderOptions.Controls.Add(GetLiteral(" <br/>")); foreach (ParleyOption option in options) { CheckBox boxOption = new CheckBox(); boxOption.Text = option.Description + ", " + currencyCode + " " + (option.AmountCents/100).ToString(); boxOption.ID = "CheckOption" + option.Identity.ToString(); this.PlaceholderOptions.Controls.Add(boxOption); this.PlaceholderOptions.Controls.Add(GetLiteral(" <br/>")); } }
protected override void CreateChildControls() { this.chkUseStandardGitClient = new CheckBox { Text = "Use Standard Git Client" }; this.txtGitExecutablePath = new SourceControlFileFolderPicker { ServerId = this.EditorContext.ServerId, Required = false, }; var ctlExePathField = new SlimFormField("Git executable path:", this.txtGitExecutablePath); this.Controls.Add( new SlimFormField("Git client:", this.chkUseStandardGitClient) { HelpText = "This extension includes a lightweight Git client for Windows. To use an alternate Git client, check the box and provide the path of the other client." }, ctlExePathField ); this.Controls.BindVisibility(this.chkUseStandardGitClient, ctlExePathField); }
protected void gvGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { CheckBox chk = new CheckBox(); chk.EnableViewState = true; chk.Enabled = true; chk.ID = "chkb"; e.Row.Cells[0].Controls.Add(chk); e.Row.TableSection = TableRowSection.TableBody; } //else if (e.Row.RowType == DataControlRowType.Header) //{ // //******* select all checkbox... **********/ // CheckBox chkBox = new CheckBox(); // chkBox.EnableViewState = true; // chkBox.Enabled = true; // chkBox.ID = "chkSelectAll"; // chkBox.CssClass = "chkSelectAll"; // chkBox.AutoPostBack = true; // //you can implement this event on server side, or create a js function and use it to check all checkboxes // //chkBox.CheckedChanged += new EventHandler(chkBox_CheckedChangedSelectAll); // chkBox.Visible = true; // e.Row.Cells[0].Controls.Add(chkBox); // e.Row.TableSection = TableRowSection.TableHeader; //} }
/// <summary> /// 设定Checkbox控制TextBox事件, /// </summary> /// <param name="ChkObj">Checkbox控件</param> /// <param name="HtmlObjId">控件TextBox ID,多个ID以,号分开</param> public static void SetChkAttrib(System.Web.UI.WebControls.CheckBox ChkObj, string HtmlObjId) { #region string[] StrId = HtmlObjId.Split(','); string JsCode = ""; for (int i = 0; i < StrId.Length; i++) { JsCode = JsCode + string.Format("EnableCtrl(this,'{0}');", StrId[i]); } ChkObj.Attributes.Add("onclick", JsCode); #endregion }
private void RecorrerYLimpiarControles(Control MyControl) { foreach (System.Web.UI.Control MyWebServerControl in MyControl.Controls) { if (MyWebServerControl.HasControls() == false) { switch (MyWebServerControl.GetType().Name.ToString()) { case "TextBox": System.Web.UI.WebControls.TextBox MyWebControlTextBox = (System.Web.UI.WebControls.TextBox)MyWebServerControl; MyWebControlTextBox.Text = ""; break; case "CheckBox": System.Web.UI.WebControls.CheckBox MyWebControlCheckbox = (System.Web.UI.WebControls.CheckBox)MyWebServerControl; MyWebControlCheckbox.Checked = false; break; case "ListBox": System.Web.UI.WebControls.ListBox MyWebControlListBox = (System.Web.UI.WebControls.ListBox)MyWebServerControl; MyWebControlListBox.SelectedIndex = -1; break; case "DropDownList": System.Web.UI.WebControls.DropDownList MyWebControlDropDownList = (System.Web.UI.WebControls.DropDownList)MyWebServerControl; MyWebControlDropDownList.SelectedIndex = -1; break; } } else { // en el control collection vienen Panels y web controls que // a su vez, contienen controls. RecorrerYLimpiarControles(MyWebServerControl); } } }
} //删除功能建议在使用时隐藏 protected void btnDelete_Click(object sender, EventArgs e) { List <string> sql = new List <string>(); string sqltext = ""; foreach (RepeaterItem LabelID in rptProNumCost.Items) { System.Web.UI.WebControls.CheckBox chk = (System.Web.UI.WebControls.CheckBox)LabelID.FindControl("CKBOX_SELECT"); if (chk.Checked) { string Id = ((System.Web.UI.WebControls.Label)LabelID.FindControl("lblId")).Text; sqltext = "delete FROM TBDS_KaoHeTotal WHERE Id='" + Id + "'"; sql.Add(sqltext); } } DBCallCommon.ExecuteTrans(sql); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('删除成功!!!');", true); bindGrid(); }
private void SetDati(bool val) { Hashtable _HS = new Hashtable(); int indice = 0; if (Session["DatiList"] != null) { _HS = (Hashtable)Session["DatiList"]; } foreach (DataGridItem o_Litem in DataGridRicerca.Items) { //DataGridField _campi = new DataGridField(); //_campi.idbl=Int32.Parse(o_Litem.Cells[0].Text); indice = Int32.Parse(o_Litem.Cells[0].Text); System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[1].FindControl("ChkSel"); cb.Checked = val; if (_HS.ContainsKey(indice)) { _HS.Remove(indice); } if (cb.Checked) { // _campi.idditta=Int32.Parse(o_Litem.Cells[2].Text); // _campi.idservizio=Int32.Parse(o_Litem.Cells[3].Text); // _campi.mesegiorno=o_Litem.Cells[11].Text; // _campi.idaddetto=Int32.Parse(o_Litem.Cells[4].Text); _HS.Add(indice, indice); } } Session.Remove("DatiList"); Session.Add("DatiList", _HS); LblElementiSelezionati.Text = "Elementi Selezionati - " + _HS.Count.ToString() + " -"; txtTotSelezionati.Text = _HS.Count.ToString(); }
protected int isselected() { int temp = 0; int i = 0; //是否选择数据 int j = 0; //是否生成结算单 foreach (RepeaterItem Reitem in Purordertotal_list_Repeater.Items) { System.Web.UI.WebControls.CheckBox cbx = Reitem.FindControl("CKBOX_SELECT") as System.Web.UI.WebControls.CheckBox; //定义checkbox if (cbx != null) //存在行 { if (cbx.Checked) { i++; string docnum = ((System.Web.UI.WebControls.Label)Reitem.FindControl("TA_DOCNUM")).Text; string sql = "select distinct TA_DOCNUM from TBMP_ACCOUNTS where TA_DOCNUM='" + docnum + "'"; System.Data.DataTable dt = DBCallCommon.GetDTUsingSqlText(sql); if (dt.Rows.Count > 1) { j++; break; } } } } if (i == 0)//未选择数据 { temp = 1; } else if (j > 0)//选择了多条订单 { temp = 2; } else { temp = 0; } return(temp); }
private void GET_SelectRow() { StringBuilder stringBuilder = new StringBuilder(); DataTable dataTable = this.ViewState[EPC_17_Ppm_ScienceInnovate_EngineerConfirmList.temTable] as DataTable; dataTable.Clear(); foreach (System.Web.UI.WebControls.DataGridItem dataGridItem in this.DGrdStandard.Items) { System.Web.UI.WebControls.CheckBox checkBox = dataGridItem.Cells[0].FindControl("chk") as System.Web.UI.WebControls.CheckBox; if (checkBox != null && checkBox.Checked) { DataRow dataRow = dataTable.NewRow(); System.Web.UI.WebControls.Label label = (System.Web.UI.WebControls.Label)dataGridItem.Cells[0].FindControl("Label3"); string text = label.Text; if (this.ViewState[EPC_17_Ppm_ScienceInnovate_EngineerConfirmList.resourceTable] != null) { DataTable dataTable2 = this.ViewState[EPC_17_Ppm_ScienceInnovate_EngineerConfirmList.resourceTable] as DataTable; DataRow[] array = dataTable2.Select("ID='" + text + "'"); DataRow[] array2 = dataTable.Select("file_sid='" + array[0]["ID"].ToString() + "'"); if (array2.Length == 0) { dataRow["ID"] = Guid.NewGuid(); dataRow["file_sid"] = array[0]["ID"].ToString(); dataRow["file_mark"] = 1; dataRow["file_name"] = array[0]["ItemName"].ToString(); dataRow["file_info"] = ((array[0]["Remark"].ToString() == "") ? "" : array[0]["Remark"].ToString()); dataRow["Original_table"] = EPC_17_Ppm_ScienceInnovate_EngineerConfirmList.table_name; dataRow["sid_ColumnName"] = "ID"; dataRow["sid_ColumnType"] = 1; dataRow["prjcode"] = ((array[0]["PrjCode"].ToString() == "") ? "" : array[0]["PrjCode"].ToString()); dataTable.Rows.Add(dataRow); stringBuilder.Append(array[0]["ID"].ToString() + ","); } } this.ViewState["i_id"] = stringBuilder.ToString(); } } this.ViewState[EPC_17_Ppm_ScienceInnovate_EngineerConfirmList.temTable] = dataTable; }
private void MemorizzaCheck() { if (this._HS == null) { this._HS = new Hashtable(); } foreach (DataGridItem o_Litem in this.p_GridRisultati.Items) { int id = Int32.Parse(o_Litem.Cells[0].Text); System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[1].FindControl("ChkSel"); if (_HS.ContainsKey(id)) { _HS.Remove(id); } if (cb.Checked) { _HS.Add(id, cb.Checked); } } }
//删除 protected void Del_Click(object Sender, EventArgs E) { int i = 0; string Str1 = ""; System.Web.UI.WebControls.CheckBox chk = default(System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label Lab = default(System.Web.UI.WebControls.Label); i = 0; foreach (GridViewRow oDataGridItem in GridView1.Rows) { chk = (CheckBox)oDataGridItem.FindControl("chk"); if (chk.Checked) { i = 1; Lab = (Label)oDataGridItem.FindControl("dp_id"); if (string.IsNullOrEmpty(Str1)) { Str1 = ((Label)oDataGridItem.FindControl("dp_id")).Text; } else { Str1 = Str1 + "','" + Lab.Text.Trim(); } } } if (i == 0) { mydb.Alert("删除失败,请先选中记录!"); return; } else { SqlHelper.ExecuteSql("Delete FROM HR_Kpdf_Bkpr02 where aid in ('" + Str1 + "')"); mydb.Alert_Refresh("删除成功!", "Bkpr.aspx"); GridViewBind(); } }
protected void btn_AllRemove_Click(object sender, EventArgs e) { int i = 0; foreach (GridViewRow gvr in grv_dayin.Rows) { System.Web.UI.WebControls.CheckBox cb = gvr.Cells[0].FindControl("cb") as System.Web.UI.WebControls.CheckBox; if (cb.Checked) { ds_dayin.Tables[0].Rows.RemoveAt(gvr.RowIndex - i); ds_dayin.Tables[0].AcceptChanges(); i++; } } DataView dv = new DataView(); dv.Table = ds_dayin.Tables[0]; dv.Sort = "样品编号,标签打印项"; grv_dayin.DataSource = dv; grv_dayin.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { int isAllConvertThis = txtThis.Text == "" ? 0 : DataTypeUtility.GetToInt32(txtThis.Text); int isAllConvertFill = txtThis.Text == "" ? 0 : DataTypeUtility.GetToInt32(txtFill.Text); int rowEffect = 0; for (int i = 0; i < ugrdKpiResultList.Rows.Count; i++) { UltraGridRow row = ugrdKpiResultList.Rows[i]; TemplatedColumn Col_Check = (TemplatedColumn)row.Band.Columns.FromKey("selchk"); System.Web.UI.WebControls.CheckBox chkCheck = (System.Web.UI.WebControls.CheckBox)((CellItem)Col_Check.CellItems[row.BandIndex]).FindControl("cBox"); if (chkCheck.Checked) { double target_ms = txtThis.Text != "" && DataTypeUtility.GetToDouble(txtThis.Text) != 0 ? DataTypeUtility.GetToDouble(txtThis.Text) : DataTypeUtility.GetToDouble((row.Cells.FromKey("RESULT_MS").Value)); double target_ts = txtFill.Text != "" && DataTypeUtility.GetToDouble(txtFill.Text) != 0 ? DataTypeUtility.GetToDouble(txtFill.Text) : DataTypeUtility.GetToDouble((row.Cells.FromKey("RESULT_TS").Value)); int kpi_pool_ref_id = DataTypeUtility.GetToInt32((row.Cells.FromKey("KPI_REF_ID").Value)); int esstid = DataTypeUtility.GetToInt32(ddlEstTermInfo.SelectedValue); string ymd = ddlEstTermMonth.SelectedValue; rowEffect += new Biz_Com_Emp_Info().Update_Result(esstid, kpi_pool_ref_id, ymd, target_ms, target_ts); } } if (rowEffect > 0) { ltrScript.Text = JSHelper.GetAlertScript("저장되었습니다."); txtFill.Text = ""; txtThis.Text = ""; Grid_Bind(); } else { ltrScript.Text = JSHelper.GetAlertScript("저장 실패."); return; } }
protected void BtnDelY_Click(object sender, EventArgs e) { MailManage mailManage = new MailManage(); foreach (System.Web.UI.WebControls.DataGridItem dataGridItem in this.DGrdNew.Items) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)dataGridItem.FindControl("cbSelSingle"); if (checkBox.Checked) { int iMailID = int.Parse(this.DGrdNew.DataKeys[dataGridItem.ItemIndex].ToString()); if (!mailManage.DelMail(iMailID, this._strSenderCode)) { this.RegisterClientScriptBlock("warn", "<SCRIPT language=\"JavaScript\">alert('在移动部分邮件过程中出错!');</SCRIPT>"); } } } if (this.DGrdNew.Items.Count > 0) { this.RegisterClientScriptBlock("Success", "<SCRIPT language=\"JavaScript\">alert('操作成功!');window.location.href=window.location.href;</SCRIPT>"); } this.DGrdNew_Bind(this.DGrdNew.CurrentPageIndex); }
protected void btnSaveAll_Click(object sender, System.EventArgs e) { int num = 0; int num2 = 0; for (int i = 0; i < this.grdMemberList.Rows.Count; i++) { System.Web.UI.WebControls.CheckBox checkBox = this.grdMemberList.Rows[i].Cells[0].Controls[0] as System.Web.UI.WebControls.CheckBox; if (checkBox.Checked) { System.Web.UI.WebControls.TextBox textBox = this.grdMemberList.Rows[i].FindControl("txtUserName") as System.Web.UI.WebControls.TextBox; int userId = (int)this.grdMemberList.DataKeys[i].Value; string empty = string.Empty; bool flag = this.UpdateMemeberBindName(textBox.Text.Trim(), userId, out empty); if (flag) { num++; } else { num2++; } } } if (num + num2 > 0) { this.BindData(); this.ShowResult(num, num2); return; } try { this.BindOpenIDAndNoUserNameCount = (int)this.ViewState["BindOpenIDAndNoUserNameCount"]; } catch (System.Exception) { } this.ShowMsg("请选择要保存的会员信息!", false); }
protected void cbl_CheckedChanged(object sender, EventArgs e) { //System.Web.UI.WebControls.CheckBox cbl_all = sender as System.Web.UI.WebControls.CheckBox; //int i = 0; //foreach (GridViewRow gvr in grv_dayin.Rows) //{ // if (gvr.RowType == DataControlRowType.DataRow) // { System.Web.UI.WebControls.CheckBox cbl = sender as System.Web.UI.WebControls.CheckBox; GridViewRow gvr = cbl.Parent.Parent as GridViewRow; if (cbl.Checked) { gvr.Cells[7].Text = "1"; ds_dayin.Tables[0].Rows[gvr.RowIndex]["xcflag"] = "1"; } else { gvr.Cells[7].Text = "0"; ds_dayin.Tables[0].Rows[gvr.RowIndex]["xcflag"] = "1"; } }
private void SaveDati(DataGrid Ctrl) { Hashtable _HS = null; if (Session["DatiListMP"] != null) { _HS = (Hashtable)Session["DatiListMP"]; } else { _HS = new Hashtable(); } foreach (DataGridItem o_Litem in Ctrl.Items) { System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[2].Controls[1]; System.Web.UI.WebControls.HyperLink link = (System.Web.UI.WebControls.HyperLink)o_Litem.Cells[3].Controls[0]; if (_HS.ContainsKey(link.Text)) { _HS.Remove(link.Text); } if (cb.Checked && cb.Enabled == true) { WRList _campi = new WRList(); WebControls.UserOption Opt = (WebControls.UserOption)o_Litem.Cells[9].FindControl("UserOption1"); _campi.id = link.Text; _campi.stato = Opt.OptChiusaSospesa.Items[0].Selected; _campi.descrizione = Opt.TxtMotivoSospensione.Text; _HS.Add(_campi.id, _campi); } } //end for Session.Remove("DatiListMP"); Session.Add("DatiListMP", _HS); }
private void GetDati(DataGrid Ctrl) { Hashtable _HS = null; if (Session["DatiListMP"] != null) { _HS = (Hashtable)Session["DatiListMP"]; } else { return; } foreach (DataGridItem o_Litem in Ctrl.Items) { System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)o_Litem.Cells[2].Controls[1]; System.Web.UI.WebControls.HyperLink link = (System.Web.UI.WebControls.HyperLink)o_Litem.Cells[3].Controls[0]; if (_HS.ContainsKey(link.Text)) { cb.Checked = true; WRList _campi = (WRList)_HS[link.Text]; WebControls.UserOption Opt = (WebControls.UserOption)o_Litem.Cells[9].FindControl("UserOption1"); if (_campi.stato == false) { Opt.OptChiusaSospesa.Items[0].Selected = false; Opt.OptChiusaSospesa.Items[1].Selected = true; Opt.TxtMotivoSospensione.Enabled = true; } else { Opt.OptChiusaSospesa.Items[0].Selected = true; Opt.OptChiusaSospesa.Items[1].Selected = false; } Opt.TxtMotivoSospensione.Text = _campi.descrizione; } } //end for }
private void btnSalveaza_Click(object sender, System.EventArgs e) { try { foreach (DataListItem it in listaNivele.Items) { int index = it.ItemIndex; int idNivel = Int32.Parse(listaNivele.DataKeys[index].ToString()); System.Web.UI.WebControls.CheckBox chk = (System.Web.UI.WebControls.CheckBox)it.FindControl("checkBoxNivel"); bool esteInNivel = chk.Checked; Salaries.Business.NivelAngajat niv = new Salaries.Business.NivelAngajat(); niv.AngajatorId = Int32.Parse(Session["AngajatorID"].ToString()); niv.IdNivelAngajat = idNivel; if (niv.EsteAngajatInNivel(AngajatID)) { if (!esteInNivel) { niv.RemoveAngajatFromNivel(AngajatID); } } else { if (esteInNivel) { niv.AddAngajatInNivel(AngajatID); } } } BindNiveleAngajat(); } catch (Exception ex) { litError.Text = "The following error occurred: <br>"; litError.Text += ex.Message; } }
protected void ddlIfzaizhi_OnSelectedIndexChanged(object sender, EventArgs e) { List <string> list_state = new List <string>(); string sqlstaff = ""; string sqlrecord = ""; foreach (GridViewRow gr in SmartGridView1.Rows) { System.Web.UI.WebControls.CheckBox cbx = (System.Web.UI.WebControls.CheckBox)gr.FindControl("checkboxstaff"); System.Web.UI.WebControls.Label lb = (System.Web.UI.WebControls.Label)gr.FindControl("ST_ID"); System.Web.UI.WebControls.Label lb_name = (System.Web.UI.WebControls.Label)gr.FindControl("ST_NAME"); if (cbx.Checked == true) { if (ddlIfzaizhi.SelectedValue != "3") { sqlstaff = "update TBDS_STAFFINFO set ST_PD='" + ddlIfzaizhi.SelectedValue.ToString() + "'where ST_ID='" + lb.Text.ToString() + "'"; list_state.Add(sqlstaff); sqlrecord = "insert into TBDS_STAFFINFO_EditRecord (bSTID, bSTNAME, Type, EditTime, EditPerId, EditPerName, Caozuo) values ('0','" + lb_name.Text.Trim() + "','人员信息表','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + Session["UserId"].ToString() + "','" + Session["UserName"].ToString() + "','修改_在职状态')"; list_state.Add(sqlrecord); } } } if (list_state.Count > 0) { try { DBCallCommon.ExecuteTrans(list_state); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('成功修改员工在职状态!');", true); } catch { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('修改失败!');", true); return; } } UCPaging1.CurrentPage = 1; databind(); }
protected void chkRow_CheckedChanged(object sender, EventArgs e) { try { foreach (GridViewRow row in gvInforme.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox); if (chkRow.Checked) { pedido.nroPedido = (row.Cells[1].FindControl("lblPedido") as Label).Text; pedido.correlativo = Convert.ToInt32((row.Cells[2].FindControl("lblCorrelativo") as Label).Text); pedido.estado = "2"; DataTable dt = new DataTable(); dt = PreparaAccesoRetiro.preparaDespacho(pedido, cadenaConexion); gvPreparaDespacho.DataSource = dt; gvPreparaDespacho.DataBind(); chkRow.Checked = false; llenaGvInforme(); } } } } catch (Exception ex) { string mensaje = ex.Message.ToString(); } }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { System.Web.UI.WebControls.Label sts = (System.Web.UI.WebControls.Label)e.Row.FindControl("Label5_sts"); System.Web.UI.WebControls.Label sts_cd = (System.Web.UI.WebControls.Label)e.Row.FindControl("app_sts"); System.Web.UI.WebControls.CheckBox cb = (System.Web.UI.WebControls.CheckBox)e.Row.FindControl("rbtnSelect2"); if (e.Row.RowType == DataControlRowType.DataRow) { if (sts.Text != "") { if (sts.Text == "TIDAK SAH") { //sts.ForeColor = Color.FromName("Red"); sts.Attributes.Add("Class", "label label-danger Uppercase"); } else if (sts.Text == "SAH") { //sts.ForeColor = Color.FromName("Green"); sts.Attributes.Add("Class", "label label-warning Uppercase"); } else if (sts.Text == "PENDING") { sts.Attributes.Add("Class", "label label-info Uppercase"); } } else { sts.ForeColor = Color.FromName("Red"); } if (sts_cd.Text == "01" || sts_cd.Text == "02") { cb.Enabled = false; } else { cb.Enabled = true; } } }
protected void btndelete_OnClick(object sender, EventArgs e) { List <string> sqltextlist = new List <string>(); int num = 0; foreach (RepeaterItem rptitem in rpt1.Items) { System.Web.UI.WebControls.CheckBox cbx1 = (System.Web.UI.WebControls.CheckBox)rptitem.FindControl("CKBOX_SELECT"); System.Web.UI.WebControls.Label lbid1 = (System.Web.UI.WebControls.Label)rptitem.FindControl("ID"); if (cbx1.Checked == true) { string sqltext = "select * from OM_JXADDSP where ID='" + lbid1.Text.Trim() + "'"; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqltext); if (dt.Rows.Count > 0 && dt.Rows[0]["totalstate"].ToString().Trim() != "0" && dt.Rows[0]["totalstate"].ToString().Trim() != "3") { num++; } } } if (num > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('所选项中有审核中或审核通过的项,不能删除!');", true); return; } foreach (RepeaterItem rptitem in rpt1.Items) { System.Web.UI.WebControls.CheckBox cbx = (System.Web.UI.WebControls.CheckBox)rptitem.FindControl("CKBOX_SELECT"); System.Web.UI.WebControls.Label lbid = (System.Web.UI.WebControls.Label)rptitem.FindControl("ID"); if (cbx.Checked == true) { string sqldelete = "delete from OM_JXADDSP where ID='" + lbid.Text.Trim() + "'"; sqltextlist.Add(sqldelete); } } DBCallCommon.ExecuteTrans(sqltextlist); UCPaging1.CurrentPage = 1; bindrpt(); }
//删除 protected void btnfjh_click(object sender, EventArgs e) { List <string> sqltextlist = new List <string>(); int num = 0; foreach (RepeaterItem rptitem in rptsushe.Items) { System.Web.UI.WebControls.CheckBox CKBOX_SELECT = (System.Web.UI.WebControls.CheckBox)rptitem.FindControl("CKBOX_SELECT"); if (CKBOX_SELECT.Checked == true) { num++; } } if (num == 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('请选择要删除的数据!');", true); return; } foreach (RepeaterItem rptitem in rptsushe.Items) { System.Web.UI.WebControls.CheckBox CKBOX_SELECT = (System.Web.UI.WebControls.CheckBox)rptitem.FindControl("CKBOX_SELECT"); System.Web.UI.WebControls.Label IDSDF = (System.Web.UI.WebControls.Label)rptitem.FindControl("IDSDF"); System.Web.UI.WebControls.Label ssnum = (System.Web.UI.WebControls.Label)rptitem.FindControl("ssnum"); System.Web.UI.WebControls.Label startdate = (System.Web.UI.WebControls.Label)rptitem.FindControl("startdate"); System.Web.UI.WebControls.Label enddate = (System.Web.UI.WebControls.Label)rptitem.FindControl("enddate"); if (CKBOX_SELECT.Checked == true) { string sqldelete1 = "delete from OM_SDFY where IDSDF='" + IDSDF.Text.Trim() + "'"; string sqldelete2 = "delete from OM_SDFdetail where fangjnum='" + ssnum.Text.Trim() + "' and startdate='" + startdate.Text.Trim() + "' and enddate='" + enddate.Text.Trim() + "'"; sqltextlist.Add(sqldelete1); sqltextlist.Add(sqldelete2); } } DBCallCommon.ExecuteTrans(sqltextlist); UCPaging1.CurrentPage = 1; bindrpt(); danyuangehebing(); }
/// <summary> /// CheckBox连选(此函数勿动) /// </summary> /// <param name="smartgridview"></param> /// <param name="ckbname"></param> public void CheckBoxSelectDefine(GridView smartgridview, string ckbname) { int startindex = -1; int endindex = -1; for (int i = 0; i < smartgridview.Rows.Count; i++) { System.Web.UI.WebControls.CheckBox cbx = (System.Web.UI.WebControls.CheckBox)smartgridview.Rows[i].FindControl(ckbname); if (cbx.Checked) { startindex = i; break; } } for (int j = smartgridview.Rows.Count - 1; j > -1; j--) { System.Web.UI.WebControls.CheckBox cbx = (System.Web.UI.WebControls.CheckBox)smartgridview.Rows[j].FindControl(ckbname); if (cbx.Checked) { endindex = j; break; } } if (startindex < 0 || endindex < 0 || startindex == endindex) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('需要勾选2条记录!!!');", true); } else { for (int k = startindex; k <= endindex; k++) { System.Web.UI.WebControls.CheckBox cbx = (System.Web.UI.WebControls.CheckBox)smartgridview.Rows[k].FindControl(ckbname); cbx.Checked = true; } } }
//启用 protected void Pass_Click(object sender, EventArgs e) { int i = 0; string Str1 = ""; // GridViewRow oDataGridItem = default(GridViewRow); System.Web.UI.WebControls.CheckBox chk = default(System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label Lab = default(System.Web.UI.WebControls.Label); i = 0; foreach (GridViewRow oDataGridItem in GridView1.Rows) { chk = (CheckBox)oDataGridItem.FindControl("chk"); if (chk.Checked) { i = 1; Lab = (Label)oDataGridItem.FindControl("dp_id"); if (string.IsNullOrEmpty(Str1)) { Str1 = ((Label)oDataGridItem.FindControl("dp_id")).Text; } else { Str1 = Str1 + "','" + Lab.Text.Trim(); } } } if (i == 0) { mydb.Alert("操作失败,请先选中记录!"); return; } else { SqlHelper.ExecuteSql("UPDATE hk_Cyy SET ZT='正常' WHERE CID IN ('" + Str1 + "') AND FL='" + xzlx.SelectedValue + "'"); GridViewBind(); } }
//Выбор записи protected void gvEmployee_SelectedIndexChanged(object sender, EventArgs e) { foreach (GridViewRow row in gvEmployee.Rows) { if (row.RowIndex == gvEmployee.SelectedIndex) { row.ToolTip = string.Empty; } else { row.ToolTip = "Нажмите, чтобы выбрать запись"; } } int selectedRow = gvEmployee.SelectedRow.RowIndex; GridViewRow rows = gvEmployee.SelectedRow; DBConnection.idRecord = Convert.ToInt32(rows.Cells[1].Text.ToString()); tbLogin.Text = rows.Cells[2].Text.ToString(); ddlRole.SelectedIndex = Convert.ToInt32(rows.Cells[4].Text.ToString()) - 1; tbSurname.Text = rows.Cells[6].Text.ToString(); tbName.Text = rows.Cells[7].Text.ToString(); tbMiddleName.Text = rows.Cells[8].Text.ToString(); tbPassportNumber.Text = rows.Cells[9].Text.ToString(); tbPassportSeries.Text = rows.Cells[10].Text.ToString(); CheckBox checkBox = (CheckBox)gvEmployee.Rows[selectedRow].Cells[11].Controls[0]; cbDelete.Checked = checkBox.Checked; tbContractNumber.Text = rows.Cells[13].Text.ToString(); tbContractDate.Text = Convert.ToDateTime(rows.Cells[14].Text.ToString()).ToString("yyyy-MM-dd"); ddlPosition.SelectedIndex = Convert.ToInt32(rows.Cells[15].Text.ToString()) - 1; DBConnection.Pay = Convert.ToDecimal(rows.Cells[17].Text.ToString()); SelectedMessage.Visible = true; cbPasswordChange.Visible = true; lblSelectedRow.Text = "Выбрана строка с ID " + DBConnection.idRecord; btUpdate.Visible = true; btDOCX.Visible = true; btPDF.Visible = true; }
private int ifselect() { int temp = 0; int i = 0;//是否选择数据 foreach (RepeaterItem Reitem in tbpc_pchsplanrvwchecklistRepeater.Items) { System.Web.UI.WebControls.CheckBox cbx = Reitem.FindControl("CKBOX_SELECT") as System.Web.UI.WebControls.CheckBox;//定义checkbox if (cbx.Checked) { i++; } } if (i == 0)//未选择数据 { temp = 1; } else { temp = 0; } return(temp); }
private void lkbDelectCheck_Click(object sender, System.EventArgs e) { ManagerHelper.CheckPrivilege(Privilege.DeleteMember); int num = 0; foreach (System.Web.UI.WebControls.GridViewRow row in this.grdMemberList.Rows) { System.Web.UI.WebControls.CheckBox box = (System.Web.UI.WebControls.CheckBox)row.FindControl("checkboxCol"); if (box.Checked && MemberHelper.Delete(System.Convert.ToInt32(this.grdMemberList.DataKeys[row.RowIndex].Value))) { num++; } } if (num == 0) { this.ShowMsg("请先选择要删除的会员账号", false); } else { this.BindData(); this.ShowMsg("成功删除了选择的会员", true); } }
private int ifselect() { int flag = 0; int i = 0;//是否选择数据 foreach (RepeaterItem Reitem in rptProNumCost.Items) { System.Web.UI.WebControls.CheckBox cbx = Reitem.FindControl("chkDel") as System.Web.UI.WebControls.CheckBox;//定义checkbox if (cbx.Checked) { i++; } } if (i == 0)//未选择数据 { flag = 1; } else { flag = 0; } return(flag); }
private void btnDeleteSelect_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <long> list = new System.Collections.Generic.List <long>(); foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.messagesList.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox != null && checkBox.Checked) { long item = (long)this.messagesList.DataKeys[gridViewRow.RowIndex].Value; list.Add(item); } } if (list.Count > 0) { NoticeHelper.DeleteManagerMessages(list); this.ShowMsg("成功删除了选择的消息.", true); } else { this.ShowMsg("请选择需要删除的消息.", false); } this.BindData(); }
public static string CheckCbx(GridView GVData, string CheckBoxName, string LabID) { string str = ""; for (int i = 0; i < GVData.Rows.Count; i++) { GridViewRow row = GVData.Rows[i]; System.Web.UI.WebControls.CheckBox Chk = (System.Web.UI.WebControls.CheckBox)row.FindControl(CheckBoxName); System.Web.UI.WebControls.Label LabVis = (System.Web.UI.WebControls.Label)row.FindControl(LabID); if (Chk.Checked == true) { if (str == "") { str = LabVis.Text.ToString(); } else { str = str + "," + LabVis.Text.ToString(); } } } return(str); }