本文整理汇总了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;
}
示例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);
}
}
示例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)
)
);
}
示例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;
}
示例5: AddedControl
protected override void AddedControl(Control control, int index)
{
base.AddedControl(control, index);
if (control is CheckBox) {
_UnderlyingCheckbox = (CheckBox)control;
}
}
示例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);
}
示例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;
}
示例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>"));
}
}
示例9: PopulateOptions
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/>"));
}
}
示例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)
);
}
示例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)
)
);
}
示例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();
}
}
}
示例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);
}
}
示例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();
}
}
示例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;
}