当前位置: 首页>>代码示例>>C#>>正文


C# WebControls.CheckBox类代码示例

本文整理汇总了C#中System.Web.UI.WebControls.CheckBox的典型用法代码示例。如果您正苦于以下问题:C# CheckBox类的具体用法?C# CheckBox怎么用?C# CheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CheckBox类属于System.Web.UI.WebControls命名空间,在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateControlInternal

        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;
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:29,代码来源:DnnFormToggleButtonItem.cs

示例2: InitializeDataCell

 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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:CheckBoxField.cs

示例3: CreateChildControls

        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)
                )
            );
        }
开发者ID:LogikBlitz,项目名称:bmx-windows,代码行数:30,代码来源:UninstallServiceActionEditor.cs

示例4: GetAdministrationInterface

 /// <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;
 }
开发者ID:ChrisNelsonPE,项目名称:surveyproject_main_public,代码行数:35,代码来源:NSurveyContextSecurityAddIn.cs

示例5: AddedControl

 protected override void AddedControl(Control control, int index)
 {
     base.AddedControl(control, index);
     if (control is CheckBox) {
         _UnderlyingCheckbox = (CheckBox)control;
     }
 }
开发者ID:Mariamfelicia,项目名称:nreco,代码行数:7,代码来源:CheckBoxList.cs

示例6: CreateChildControls

        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);
        }
开发者ID:ABrehm264,项目名称:bmx-git,代码行数:25,代码来源:GitSourceControlProviderEditor.cs

示例7: CreateEditor

 /// <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;
 }
开发者ID:dpawatts,项目名称:zeus,代码行数:10,代码来源:CheckBoxEditorAttribute.cs

示例8: RenderCrossSellCurrent

        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>"));
            }
        }
开发者ID:xcrash,项目名称:cuyahogacontrib-Cuyahoga.Modules.ECommerce,代码行数:26,代码来源:CrossSellEditor.ascx.cs

示例9: PopulateOptions

        private void PopulateOptions()
        {
            ParleyOptions options = ParleyOptions.ForParley(_parley);

            string spacer = string.Empty;

            for (int loop = 0; loop < options.Count; loop++)
            {
                spacer += "&nbsp;<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("&nbsp;<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("&nbsp;<br/>"));
            }
        }
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:34,代码来源:ParleySignup.aspx.cs

示例10: CreateChildControls

        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)
            );
        }
开发者ID:LogikBlitz,项目名称:bmx-windowssdk,代码行数:33,代码来源:WriteAssemblyInfoVersionsActionEditor.cs

示例11: CreateChildControls

        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)
                )
            );
        }
开发者ID:mwpnl,项目名称:bmx-tfs,代码行数:28,代码来源:CreateTfsBuildActionEditor.cs

示例12: btn_Sub_Click

        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();
                }

            }
        }
开发者ID:dalinhuang,项目名称:cy-common,代码行数:25,代码来源:EditPageCtrl.aspx.cs

示例13: fillOperationsTable

        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);
            }
        }
开发者ID:supermuk,项目名称:iudico,代码行数:28,代码来源:CourseShareController.cs

示例14: UpdateCartItems

        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();
            }
        }
开发者ID:MhdNZ,项目名称:MenStore,代码行数:34,代码来源:ShoppingCart.aspx.cs

示例15: GetFieldControl

        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;
        }
开发者ID:chutinhha,项目名称:aiaintranet,代码行数:26,代码来源:SPFieldExtensions.cs


注:本文中的System.Web.UI.WebControls.CheckBox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。