本文整理汇总了C#中System.Web.UI.HtmlControls.HtmlInputCheckBox类的典型用法代码示例。如果您正苦于以下问题:C# HtmlInputCheckBox类的具体用法?C# HtmlInputCheckBox怎么用?C# HtmlInputCheckBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlInputCheckBox类属于System.Web.UI.HtmlControls命名空间,在下文中一共展示了HtmlInputCheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstantiateIn
/// <summary>
///
/// </summary>
/// <param name="container"></param>
public void InstantiateIn(Control container)
{
switch (this.templateType)
{
case DataControlRowType.Header:
htmlControls.HtmlInputCheckBox checkBoxAll = new htmlControls.HtmlInputCheckBox();
checkBoxAll.ID = "checkall";
checkBoxAll.Name = this.checkItemName;
checkBoxAll.Value = "选全";
container.Controls.Add(checkBoxAll);
if (this.isMultiSelect == false)
checkBoxAll.Style["display"] = "none";
break;
case DataControlRowType.DataRow:
InputButton checkBox = new InputButton();
checkBox.Name = this.checkItemName;
checkBox.ID = "checkitem";
if (this.isMultiSelect)
checkBox.ButtonType = InputButtonType.CheckBox;
else
checkBox.ButtonType = InputButtonType.Radio;
checkBox.Value = "";
container.Controls.Add(checkBox);
break;
}
}
示例2: AddCashTransactionDivCell
private void AddCashTransactionDivCell(HtmlTableRow row)
{
using (HtmlTableCell cell = TableHelper.GetFieldCell())
{
if (this.ShowTransactionType)
{
using (HtmlGenericControl toggleCheckBox = HtmlControlHelper.GetToggleCheckBox())
{
toggleCheckBox.ID = "CashTransactionDiv";
using (HtmlInputCheckBox cashTransactionInputCheckBox = new HtmlInputCheckBox())
{
cashTransactionInputCheckBox.ID = "CashTransactionInputCheckBox";
cashTransactionInputCheckBox.Attributes.Add("checked", "checked");
toggleCheckBox.Controls.Add(cashTransactionInputCheckBox);
}
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.CashTransaction))
{
toggleCheckBox.Controls.Add(label);
}
cell.Controls.Add(toggleCheckBox);
}
}
row.Cells.Add(cell);
}
}
示例3: AddCashTransactionDivField
private void AddCashTransactionDivField(HtmlGenericControl container)
{
using (HtmlGenericControl field = HtmlControlHelper.GetField())
{
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(" "))
{
field.Controls.Add(label);
}
using (HtmlGenericControl toggleCheckBox = HtmlControlHelper.GetToggleCheckBox())
{
toggleCheckBox.ID = "CashTransactionDiv";
using (HtmlInputCheckBox cashTransactionInputCheckBox = new HtmlInputCheckBox())
{
cashTransactionInputCheckBox.ID = "CashTransactionInputCheckBox";
cashTransactionInputCheckBox.Attributes.Add("checked", "checked");
toggleCheckBox.Controls.Add(cashTransactionInputCheckBox);
}
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.CashTransaction))
{
toggleCheckBox.Controls.Add(label);
}
field.Controls.Add(toggleCheckBox);
}
container.Controls.Add(field);
}
}
示例4: AddCompactCheckBoxField
private void AddCompactCheckBoxField(HtmlGenericControl container)
{
using (HtmlGenericControl field = HtmlControlHelper.GetField())
{
using (HtmlGenericControl slider = new HtmlGenericControl("div"))
{
slider.Attributes.Add("class", "ui checkbox");
using (HtmlInputCheckBox checkBox = new HtmlInputCheckBox())
{
checkBox.ID = "CompactCheckBox";
checkBox.Checked = false;
slider.Controls.Add(checkBox);
this.isCompactHidden = new HiddenField();
this.isCompactHidden.ID = "IsCompactHidden";
this.isCompactHidden.Value = "0";
slider.Controls.Add(this.isCompactHidden);
}
using (HtmlGenericControl label = HtmlControlHelper.GetLabel(Titles.ShowCompact))
{
slider.Controls.Add(label);
}
field.Controls.Add(slider);
}
container.Controls.Add(field);
}
}
示例5: AddCheckBox
void AddCheckBox(string option)
{
HtmlInputCheckBox cb = new HtmlInputCheckBox();
Controls.Add(cb);
cb.ID = option;
cb.Attributes["onchange"] = string.Format("AnthemDebugger_Debug{0} = this.checked", option);
Controls.Add(new LiteralControl(string.Format(" {0} ", option)));
}
示例6: DefaultProperties
public void DefaultProperties ()
{
HtmlInputCheckBox c = new HtmlInputCheckBox ();
Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count");
Assert.IsFalse (c.Checked, "Checked");
Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
}
示例7: CleanProperties
public void CleanProperties ()
{
HtmlInputCheckBox c = new HtmlInputCheckBox ();
c.Checked = true;
Assert.AreEqual (2, c.Attributes.Count, "Attributes.Count");
c.Checked = false;
Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count after");
}
示例8: lbtDelete_Click
protected void lbtDelete_Click(object sender, EventArgs e)
{
int i = 0;
int j = 0;
HtmlInputCheckBox check = new HtmlInputCheckBox();
int[] items = new int[rptList.Items.Count];
try
{
foreach (RepeaterItem item in rptList.Items)
{
check = new HtmlInputCheckBox();
check = (HtmlInputCheckBox)item.FindControl("chkSelect");
Label lblID = (Label)item.FindControl("lblID");
if (check.Checked)
{
int catId = Utils.CIntDef(lblID.Text, 0);
items[j] = catId;
try
{
//delete folder
string fullpath = Server.MapPath(PathFiles.GetPathNews(items[j]));
if (Directory.Exists(fullpath))
{
DeleteAllFilesInFolder(fullpath);
Directory.Delete(fullpath);
}
}
catch (Exception)
{ }
j++;
}
i++;
}
//delete
var g_delete = DB.GetTable<ESHOP_AD_ITEM>().Where(g => items.Contains(g.AD_ITEM_ID));
DB.ESHOP_AD_ITEMs.DeleteAllOnSubmit(g_delete);
DB.SubmitChanges();
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
finally
{
items = null;
SearchResult();
}
}
示例9: NullProperties
public void NullProperties ()
{
HtmlInputCheckBox c = new HtmlInputCheckBox ();
Assert.AreEqual (1, c.Attributes.Count, "Attributes.Count");
Assert.AreEqual ("checkbox", c.Attributes["type"], "Attributes[\"type\"]");
c.Checked = true;
Assert.IsTrue (c.Checked, "Checked");
Assert.AreEqual (2, c.Attributes.Count, "Attributes.Count after");
Assert.AreEqual ("checked", c.Attributes["checked"], "Attributes[\"checked\"]");
}
示例10: SaveNewsCat
private void SaveNewsCat()
{
string strLink = "";
try
{
int i = 0;
HtmlInputCheckBox check = new HtmlInputCheckBox();
var gcdel = (from gp in DB.ESHOP_NEWS_CATs
where gp.NEWS_ID == m_news_id
select gp);
DB.ESHOP_NEWS_CATs.DeleteAllOnSubmit(gcdel);
foreach (RepeaterItem item in rptList.Items)
{
check = new HtmlInputCheckBox();
check = (HtmlInputCheckBox)item.FindControl("chkSelect");
Label lblID = (Label)item.FindControl("lblID");
if (check.Checked)
{
int _Id = Utils.CIntDef(lblID.Text, 0);
ESHOP_NEWS_CAT grinsert = new ESHOP_NEWS_CAT();
grinsert.CAT_ID = _Id;
grinsert.NEWS_ID = m_news_id;
DB.ESHOP_NEWS_CATs.InsertOnSubmit(grinsert);
}
i++;
}
DB.SubmitChanges();
strLink = "news.aspx?news_id=" + m_news_id;
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
finally
{
if (!string.IsNullOrEmpty(strLink))
Response.Redirect(strLink);
}
}
示例11: InstantiateIn
public void InstantiateIn(Control container)
{
using (HtmlGenericControl toggleCheckBox = new HtmlGenericControl("div"))
{
toggleCheckBox.Attributes.Add("class", "ui toggle checkbox");
using (HtmlInputCheckBox checkBox = new HtmlInputCheckBox())
{
toggleCheckBox.Controls.Add(checkBox);
}
using (HtmlGenericControl label = new HtmlGenericControl("label"))
{
toggleCheckBox.Controls.Add(label);
}
container.Controls.Add(toggleCheckBox);
}
}
示例12: lbtDelete_Click
protected void lbtDelete_Click(object sender, EventArgs e)
{
int i = 0;
int j = 0;
HtmlInputCheckBox check = new HtmlInputCheckBox();
int[] items = new int[rptList.Items.Count];
try
{
foreach (RepeaterItem item in rptList.Items)
{
check = new HtmlInputCheckBox();
check = (HtmlInputCheckBox)item.FindControl("chkSelect");
Label lblID = (Label)item.FindControl("lblID");
if (check.Checked)
{
int catId = Utils.CIntDef(lblID.Text, 0);
items[j] = catId;
j++;
}
i++;
}
//delete
var g_delete = DB.GetTable<ESHOP_CATEGORy>().Where(g => items.Contains(g.CAT_ID));
DB.ESHOP_CATEGORies.DeleteAllOnSubmit(g_delete);
DB.SubmitChanges();
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
finally
{
items = null;
//SearchResult();
}
Response.Redirect("category_list.aspx");
}
示例13: lbtDelete_Click
protected void lbtDelete_Click(object sender, EventArgs e)
{
int i = 0;
int j = 0;
HtmlInputCheckBox check = new HtmlInputCheckBox();
int[] items = new int[GridItemList.Items.Count];
try
{
foreach (DataGridItem item in GridItemList.Items)
{
check = new HtmlInputCheckBox();
check = (HtmlInputCheckBox)item.Cells[1].FindControl("chkSelect");
if (check.Checked)
{
items[j] = Utils.CIntDef(GridItemList.DataKeys[i]);
j++;
}
i++;
}
//delete
var g_delete = db.GetTable<BAOHANH>().Where(g => items.Contains(g.ID));
db.BAOHANHs.DeleteAllOnSubmit(g_delete);
db.SubmitChanges();
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
finally
{
items = null;
loadListBaohanh();
}
}
示例14: SaveNewsCat
private void SaveNewsCat()
{
string strLink = "";
try
{
HtmlInputCheckBox check = new HtmlInputCheckBox();
var gcdel = (from gp in DB.ESHOP_NEWS_CATs
where gp.NEWS_ID == m_news_id
select gp);
DB.ESHOP_NEWS_CATs.DeleteAllOnSubmit(gcdel);
for (int i = 0; i < Rplistcate.Items.Count; i++)
{
check = new HtmlInputCheckBox();
check = (HtmlInputCheckBox)Rplistcate.Items[i].FindControl("chkSelect");
HiddenField Hdid = Rplistcate.Items[i].FindControl("Hdcatid") as HiddenField;
int _catid = Utils.CIntDef(Hdid.Value);
if (check.Checked)
{
ESHOP_NEWS_CAT grinsert = new ESHOP_NEWS_CAT();
grinsert.CAT_ID = _catid;
grinsert.NEWS_ID = m_news_id;
DB.ESHOP_NEWS_CATs.InsertOnSubmit(grinsert);
}
}
DB.SubmitChanges();
strLink = "news.aspx?news_id=" + m_news_id;
}
catch (Exception ex)
{
clsVproErrorHandler.HandlerError(ex);
}
finally
{
if (!string.IsNullOrEmpty(strLink))
Response.Redirect(strLink);
}
}
示例15: RenderDivShowHide
private void RenderDivShowHide(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "itemlistcontainer");
writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_DivShowHide");
writer.AddAttribute("itemalign", ItemAlign.ToString());
writer.AddAttribute(HtmlTextWriterAttribute.Style, "display: none; z-index: 500;");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Style, "padding: 5px;");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
RenderCheckBoxDiv(writer);
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Class, "divconfirm");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
if (ShowCheckAll && SingleMode == SingledType.NotSet)
{
HtmlInputCheckBox cb = new HtmlInputCheckBox();
cb.ID = this.ClientID + "_SelectAll";
cb.Attributes.Add("onclick", "CheckBoxSelectAll('" + this.ClientID + "');");
cb.RenderControl(writer);
writer.AddAttribute("for", this.ClientID + "_SelectAll");
writer.RenderBeginTag(HtmlTextWriterTag.Label);
writer.Write("全选 ");
writer.RenderEndTag();
writer.Write(" ");
}
HtmlInputButton confirm = new HtmlInputButton();
confirm.Value = "确 定";
confirm.Attributes.Add("class", "btn");
confirm.Attributes.Add("onclick", "CheckBoxListConfirm('" + this.ClientID + "'); HideComboBoxDiv('" + this.ClientID + "');");
confirm.RenderControl(writer);
writer.Write(" ");
HtmlInputButton cancel = new HtmlInputButton();
cancel.Value = "取 消";
cancel.Attributes.Add("class", "btn");
cancel.Attributes.Add("onclick", "HideComboBoxDiv('" + this.ClientID + "');");
cancel.RenderControl(writer);
writer.RenderEndTag();
writer.RenderEndTag();
}