/// <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; } }
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); } }
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); } }
public bool HasFutureBookings(Staff staff, System.Web.UI.HtmlControls.HtmlInputCheckBox chkBox, DayOfWeek dayOfWeek) { if (chkBox.Checked) { return(false); } Booking[] bookings = BookingDB.GetFutureBookings(staff, null, dayOfWeek.ToString(), new TimeSpan(0, 0, 0), new TimeSpan(23, 59, 59)); if (bookings.Length == 0) { return(false); } string space = " "; string bookingDates = string.Empty; for (int i = 0; i < bookings.Length; i++) { bookingDates += "<br />" + space + bookings[i].DateStart.ToString(@"ddd MMM d, yyy HH:mm"); } lblErrorMessage.Text = "Can not select " + dayOfWeek.ToString() + " as not working until the bookings on the following days have been moved or deleted:" + "<br />" + bookingDates + "<br />"; lblErrorMessage.Visible = true; return(true); }
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); } }
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))); }
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"); }
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"); }
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(); } }
public int userid; //用户ID #endregion Fields #region Methods protected void Bind(int id) { lb_ID.Text = id.ToString(); CY.GFive.Core.Business.Vote vote = CY.GFive.Core.Business.Vote.Load(id); lb_VoteName.Text = vote.VoteTitle; IList<CY.GFive.Core.Business.VoteItem> itemlist = CY.GFive.Core.Business.VoteItem.GetVoteItemByVoteID(id); int Anscount = 0; for (int i = 0; i < itemlist.Count; i++) { lb_Title.Controls.Add(new LiteralControl("<p>")); lb_Title.Controls.Add(new LiteralControl(itemlist[i].VoteItemContent)); if (itemlist[i].IsMutiChoose == 1) { lb_Title.Controls.Add(new LiteralControl("(多选):")); } else { lb_Title.Controls.Add(new LiteralControl(":")); } lb_Title.Controls.Add(new LiteralControl("</p>")); lb_Title.Controls.Add(new LiteralControl("<p>")); IList<CY.GFive.Core.Business.VoteAnswer> answerlist = CY.GFive.Core.Business.VoteAnswer.GetVoteAnswerByVoteItemID(itemlist[i].Id); lb_ItemCount.Text = itemlist[i].Id.ToString(); for (int j = 0; j < answerlist.Count; j++) { if (itemlist[i].IsMutiChoose == 0) { HtmlInputRadioButton rb1 = new HtmlInputRadioButton(); rb1.ID = answerlist[j].Id.ToString(); rb1.Attributes.Add("runat", "server"); rb1.Name = "rb_" + itemlist[i].Id; lb_Title.Controls.Add(rb1); lb_Title.Controls.Add(new LiteralControl(answerlist[j].VoteAnswerContent + " ")); if (Anscount <= answerlist[j].Id) { Anscount = answerlist[j].Id; } } if (itemlist[i].IsMutiChoose == 1) { HtmlInputCheckBox cb1 = new HtmlInputCheckBox(); cb1.ID = "cb_" + itemlist[i].Id + "_" + answerlist[j].Id.ToString(); cb1.Attributes.Add("runat", "server"); lb_Title.Controls.Add(cb1); lb_Title.Controls.Add(new LiteralControl(answerlist[j].VoteAnswerContent + " ")); if (Anscount <= answerlist[j].Id) { Anscount = answerlist[j].Id; } } } if (itemlist[i].IsUserDefine == 1) { lb_Title.Controls.Add(new LiteralControl("其它答案")); HtmlInputText tb1 = new HtmlInputText(); tb1.ID = "tb_" + itemlist[i].Id.ToString(); lb_Title.Controls.Add(tb1); } lb_Title.Controls.Add(new LiteralControl("<p>")); } lb_anscount.Text = Anscount.ToString(); }
private void ShowInfo(int _id) { Cms.BLL.C_admin_role bll = new Cms.BLL.C_admin_role(); Cms.Model.C_admin_role model = bll.GetModel(_id); txtRoleName.Text = model.role_name; ddlRoleType.SelectedValue = model.role_type.ToString(); //管理权限 for (int i = 0; i < rptList.Items.Count; i++) { string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value; // CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5"); // for (int n = 0; n < cblActionType.Items.Count; n++) { Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); DataSet ds = bllrole_value.GetList("nav_name='" + navName + "' and role_id=" + _id); if (ds != null && ds.Tables[0].Rows.Count > 0) { string[] actionTypeArr = ds.Tables[0].Rows[0]["action_type"].ToString().Split(','); for (int j = 0; j < actionTypeArr.Length; j++) { if (j == 0) { checkbox1.Checked = true; } if (j == 1) { checkbox2.Checked = true; } if (j == 2) { checkbox3.Checked = true; } if (j == 3) { checkbox4.Checked = true; } if (j == 4) { checkbox5.Checked = true; } } //cblActionType.Items[n].Selected = true; } } } }
protected void dgvGridView_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e) { switch (e.Row.RowType) { case DataControlRowType.DataRow: string strID = dgvGridView.DataKeys[e.Row.RowIndex].Values[0].ToString(); System.Web.UI.HtmlControls.HtmlInputCheckBox chk = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Row.FindControl("chkSelectRow"); chk.ID = "chkSelectRow_" + strID; chk.Attributes.Add("OnClick", "javascript:SelectRow(this," + strID + ")"); break; } }
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\"]"); }
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); } }
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); } }
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"); }
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(); } }
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); } }
/// <summary> /// Request Object true/false Flag /// </summary> /// <param name="FormObject">CheckBox, HtmlInputCheckBox</param> /// <param name="sDefaultValue"></param> /// <returns>boolean</returns> public static Boolean rfb(object FormObject, Boolean sDefaultValue = false) { Boolean bRet = sDefaultValue; if (FormObject != null) { try { CheckBox obj = (CheckBox)FormObject; bRet = obj.Checked; } catch { } try { System.Web.UI.HtmlControls.HtmlInputCheckBox obj = (System.Web.UI.HtmlControls.HtmlInputCheckBox)FormObject; bRet = obj.Checked; } catch { } } return(bRet); }
private void Page_Load(object sender, System.EventArgs e) { SetPageTitle("新建/编辑企业信息"); // 06/04/2006 Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load. // 03/10/2010 Apply full ACL security rules. this.Visible = (Taoqi.Security.AdminUserAccess(m_sMODULE, "list") >= 0); if (!this.Visible) { // 03/17/2010 We need to rebind the parent in order to get the error message to display. Parent.DataBind(); return; } try { gID = Sql.ToGuid(Request["ID"]); if (!IsPostBack) { if (!Sql.IsEmptyGuid(gID)) { DbProviderFactory dbf = DbProviderFactories.GetFactory(); using (IDbConnection con = dbf.CreateConnection()) { string sSQL; // 09/08/2010 We need a separate view for the list as the default view filters by MODULE_ENABLED // and we don't want to filter by that flag in the ListView, DetailView or EditView. sSQL = "select * " + ControlChars.CrLf + " from vwTQClient" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; using (IDbCommand cmd = con.CreateCommand()) { cmd.CommandText = sSQL; Sql.AppendParameter(cmd, gID, "ID", false); con.Open(); } } } else { this.AppendEditViewFields(m_sMODULE + "." + LayoutEditView, tblMain, null); ctlDynamicButtons.AppendButtons(m_sMODULE + "." + LayoutEditView, Guid.Empty, null); ctlFooterButtons.AppendButtons(m_sMODULE + "." + LayoutEditView, Guid.Empty, null); var C_CustomerManager = new DynamicControl(this, "C_CustomerManager"); if (C_CustomerManager != null) { C_CustomerManager.Text = Security.FULL_NAME; } } } else { ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]); SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title); } } catch (Exception ex) { SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex); //ctlDynamicButtons.ErrorText = ex.Message; } if (Request.QueryString["isDlg"] != null) { //2014.12.14 Button btnCancel = this.ctlDynamicButtons.FindButton("Cancel") as Button; if (btnCancel != null) { btnCancel.Visible = false; } Button btnCancel_footer = this.ctlFooterButtons.FindButton("Cancel") as Button; if (btnCancel_footer != null) { btnCancel_footer.Visible = false; } } gUserID = Security.USER_ID; if (!Guid.TryParse(Request.QueryString["id"], out gClientID)) Response.Redirect("~/Client"); txtClientName = FindControl("txtClientName") as HtmlInputText; txtClientShortName = FindControl("txtClientShortName") as HtmlInputText; hiddenUserID = FindControl("hiddenUserID") as HiddenField; txtUserName = FindControl("txtUserName") as TextBox; cbxSeller = FindControl("cbxSeller") as HtmlInputCheckBox; cbxBuyer = FindControl("cbxBuyer") as HtmlInputCheckBox; //C_Status_WSH = FindControl("C_Status_WSH") as HtmlInputRadioButton; C_Status_TG = FindControl("C_Status_TG") as HtmlInputRadioButton; C_Status_WTG = FindControl("C_Status_WTG") as HtmlInputRadioButton; C_Status_TGBQJRRM = FindControl("C_Status_TGBQJRRM") as HtmlInputRadioButton; if(!IsPostBack) AccountInformation(); if (IsPostBack) { if (Request.Form["Save"] == "Save") { Guid.TryParse(hiddenUserID.Value, out NewBossID); if (NewBossID == Guid.Empty) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsg", "layer.alert('请为该公司指定管理员!', {area:['385px','178px'],offset:['195px','500px']});", true); return; } if (C_Status_TG.Checked) C_Status = 2; else if (C_Status_WTG.Checked) C_Status = 3; else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsg", "layer.alert('审核意见必选!', {area:['385px','178px'],offset:['195px','500px']});", true); return; } C_Category = GetUserType(); C_ClientShortName = txtClientShortName.Value; SqlProcs.spTQClient_Update_ForAdmin( ref gClientID , C_Category , C_ClientShortName , NewBossID , C_BossRole , Security.USER_ID , C_Status ); if (C_Status == 2) // 审核成功 Msg.ClientAudit(NewBossID, gClientID); else Msg.ClientAudit(NewBossID, gClientID, false); Response.Redirect("default.aspx"); } else if (Request.Form["Cancel"] == "Cancel") { Response.Redirect("default.aspx"); } } if (!IsPostBack) showInformation(); }
protected void DataListSubOrder_RowDataBound(object sender, System.Web.UI.WebControls.DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataList DataListSubOrder = (DataList)sender; string strSubOrderId = DataListSubOrder.DataKeys[e.Item.ItemIndex].ToString(); //CheckBox chk = (CheckBox)e.Item.FindControl("chkSelectRow"); System.Web.UI.HtmlControls.HtmlInputCheckBox chk = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("chkSelectRow"); if (chk != null) { chk.ID = "chkSelectRow_" + strSubOrderId; chk.Attributes.Add("OnClick", "javascript:SelectRow(this," + strSubOrderId + ")"); } HiddenField hdnStatus = (HiddenField)e.Item.FindControl("hdnStatus"); HiddenField hdnOrderId = (HiddenField)e.Item.FindControl("hdnOrderId"); HiddenField hdnReturnStatus = (HiddenField)e.Item.FindControl("hdnReturnStatus"); HiddenField hdnDocketNo = (HiddenField)e.Item.FindControl("hdnDocketNo"); HiddenField hdnTotaldiscount = (HiddenField)e.Item.FindControl("hdnTotaldiscount"); System.Web.UI.HtmlControls.HtmlGenericControl divDiscount = (System.Web.UI.HtmlControls.HtmlGenericControl)e.Item.FindControl("divDiscount"); if (hdnTotaldiscount != null) { if (hdnTotaldiscount.Value != "") { if (Convert.ToDecimal(hdnTotaldiscount.Value) < 1) { divDiscount.Visible = false; } else { divDiscount.Visible = true; } } } if (hdnStatus != null) { int statusID = Convert.ToInt32(hdnStatus.Value); LinkButton lnkbtnCancel = (LinkButton)e.Item.FindControl("lnkbtnCancel"); LinkButton lnkbtnReturn = (LinkButton)e.Item.FindControl("lnkbtnReturn"); // lnkbtnCancel.CssClass = " btn btn-default danger "; // lnkbtnReturn.CssClass = " btn btn-default danger "; if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Complete) || statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Shipped)) { lnkbtnReturn.Style.Add("display", "none"); lnkbtnCancel.Style.Add("display", "none"); if (chk != null) { chk.Style.Add("display", "none"); } } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Delivered)) { lnkbtnReturn.Style.Add("display", "block"); // lnkbtnReturn.CssClass = " btn btn-default danger btnReturn " + hdnOrderId.Value; lnkbtnCancel.Style.Add("display", "none"); if (chk != null) { chk.Attributes.Add("class", "Return " + hdnOrderId.Value); } } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Ordered) || statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Confirmed) || statusID == Convert.ToInt32(Enums.Enums_OrderStatus.ReadyToShip)) { lnkbtnCancel.Style.Add("display", "block"); // lnkbtnCancel.CssClass = " btn btn-default danger btnCancel " + hdnOrderId.Value; lnkbtnReturn.Style.Add("display", "none"); if (chk != null) { chk.Attributes.Add("class", "Cancel " + hdnOrderId.Value); } } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Returned)) { lnkbtnCancel.Style.Add("display", "none"); lnkbtnReturn.Style.Add("display", "none"); if (chk != null) { chk.Style.Add("display", "none"); } } else { lnkbtnCancel.Style.Add("display", "none"); lnkbtnReturn.Style.Add("display", "none"); if (chk != null) { chk.Style.Add("display", "none"); } } if (hdnReturnStatus.Value != "") { if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Dispatched)) { lnkbtnReturn.Style.Add("display", "none"); } } Label lblStatusName = (Label)e.Item.FindControl("lblStatusName"); if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Ordered)) { lblStatusName.Text = Enums.Enums_OrderStatus.Ordered.ToString(); } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Confirmed)) { lblStatusName.Text = Enums.Enums_OrderStatus.Confirmed.ToString(); } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.CancelledByAdmin)) { lblStatusName.Text = "Cancelled By FabyMart"; } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.ReadyToShip)) { lblStatusName.Text = "Ready To Ship"; } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Shipped)) { lblStatusName.Text = Enums.Enums_OrderStatus.Shipped.ToString(); } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Delivered)) { lblStatusName.Text = Enums.Enums_OrderStatus.Delivered.ToString(); } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail)) { lblStatusName.Text = "Payment Fail"; lblStatusName.Style.Add("color", "red"); } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Returned)) { lblStatusName.Text = Enums.Enums_OrderStatus.Returned.ToString(); if (hdnReturnStatus.Value != "") { if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Requested)) { lblStatusName.Text = lblStatusName.Text + " Request"; } else if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Approved) || Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Slip)) { lblStatusName.Text = lblStatusName.Text + " Approved "; LinkButton lnkReturnAddress = (LinkButton)e.Item.FindControl("lnkReturnAddress"); lnkReturnAddress.CssClass = "SlipLink"; lnkReturnAddress.Visible = true; LinkButton lnkDispatch = (LinkButton)e.Item.FindControl("lnkDispatch"); if (hdnDocketNo.Value == "") { lnkDispatch.Visible = false; } else { lnkDispatch.Visible = true; lnkReturnAddress.Visible = false; } } else if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Dispatched)) { lblStatusName.Text = lblStatusName.Text + " Dispatched"; } else if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Complete)) { lblStatusName.Text = lblStatusName.Text + " Complete"; } else if (Convert.ToInt32(hdnReturnStatus.Value) == Convert.ToInt32(Enums.Enum_ReturnStatus.Requested)) { lblStatusName.Text = lblStatusName.Text + " Requested"; } } } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.CancelledByCustomer)) { lblStatusName.Text = "Cancelled"; } else if (statusID == Convert.ToInt32(Enums.Enums_OrderStatus.Complete)) { lblStatusName.Text = Enums.Enums_OrderStatus.Complete.ToString(); } } } }
/// <summary> /// Request Object Form Value /// </summary> /// <param name="FormObject">WebControls, HtmlControls</param> /// <param name="sDefaultValue"></param> /// <returns>String</returns> public static string rf(object FormObject, string sDefaultValue = null) { string sRet = sDefaultValue; if (FormObject != null) { try { TextBox obj = (TextBox)FormObject; sRet = obj.Text; } catch { } finally { } try { System.Web.UI.HtmlControls.HtmlInputText obj = (System.Web.UI.HtmlControls.HtmlInputText)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputHidden obj = (System.Web.UI.HtmlControls.HtmlInputHidden)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlTextArea obj = (System.Web.UI.HtmlControls.HtmlTextArea)FormObject; sRet = obj.InnerText; } catch { } try { DropDownList obj = (DropDownList)FormObject; sRet = obj.SelectedItem.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlSelect obj = (System.Web.UI.HtmlControls.HtmlSelect)FormObject; sRet = obj.Value; } catch { } try { RadioButtonList obj = (RadioButtonList)FormObject; sRet = obj.SelectedItem.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputCheckBox obj = (System.Web.UI.HtmlControls.HtmlInputCheckBox)FormObject; sRet = obj.Value; } catch { } try { System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton)FormObject; sRet = obj.Value; } catch { } } return(sRet); }
private void SaveGroupCat(int GroupId) { try { int i = 0; HtmlInputCheckBox check = new HtmlInputCheckBox(); var gcdel = (from gp in DB.ESHOP_GROUP_CATs where gp.GROUP_ID == GroupId select gp); DB.ESHOP_GROUP_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_GROUP_CAT grinsert = new ESHOP_GROUP_CAT(); grinsert.CAT_ID = _Id; grinsert.GROUP_ID = GroupId; DB.ESHOP_GROUP_CATs.InsertOnSubmit(grinsert); } i++; } //DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
protected void lbtSave_Click(object sender, EventArgs e) { HtmlInputCheckBox check = new HtmlInputCheckBox(); string strLink = ""; int i = 0; try { foreach (DataGridItem item in GridItemList.Items) { check = new HtmlInputCheckBox(); check = (HtmlInputCheckBox)item.Cells[1].FindControl("chkSelect"); if (check.Checked) { strLink = "units.aspx?unit_id=" + Utils.CStrDef(GridItemList.DataKeys[i]); break; } i++; } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { if (!string.IsNullOrEmpty(strLink)) Response.Redirect(strLink); } }
/// <summary> /// Initializes the checklists. Checklists provides additional search result filtering functionality. /// It's stored in the catalog settings folder. /// </summary> /// <param name="checklists">The checklists.</param> public void InitializeChecklists(IEnumerable<ChecklistDefinition> checklists) { this.Checklists = new NameValueCollection(); foreach (var checklist in checklists) { var args = new ChecklistEventArgs { ChecklistDefinition = checklist }; this.OnChecklistCreating(args); var border = new Border(); border.Attributes["class"] = "scChecklist"; this.ChecklistContainer.Controls.Add(border); var header = new Border { ID = Control.GetUniqueID("ChecklistHeader"), InnerHtml = checklist.Header }; header.Attributes["class"] = "scChecklistHeader"; border.Controls.Add(header); var checklistBorder = new Border { ID = Control.GetUniqueID("ChecklistBody") }; checklistBorder.Attributes["name"] = CheckListIdPrefix + checklist.Field; checklistBorder.Attributes["class"] = "scChecklistItems"; border.Controls.Add(checklistBorder); foreach (var checklistItem in checklist.Checkboxes) { var cb = new HtmlInputCheckBox { ID = string.Concat(Control.GetUniqueID("checkbox_"), CheckListIdPrefix, checklist.Field), Checked = args.CheckedValues != null && args.CheckedValues.Contains(checklistItem.Value), Value = checklistItem.Value }; checklistBorder.Controls.Add(cb); var label = new LiteralControl(string.Format("<label for=\"{0}\">{1}</label><br />", cb.ClientID, checklistItem.Text)); checklistBorder.Controls.Add(label); if (cb.Checked) { AddListStringValue(this.Checklists, checklist.Field, checklistItem.Value); } } } }
private void CreateTable() { if(this.DataSource==null) return; TableRow row; TableCell cell; HtmlInputRadioButton radio; HtmlInputCheckBox chkbox; int currentPage=this.CurrentPage; if(EnablePages==false) PageSize=DataSource.Rows.Count; int startIndex=this.CurrentPage*PageSize-PageSize; int endIndex=this.CurrentPage*PageSize-1; if(endIndex>=DataSource.DefaultView.Count) endIndex=DataSource.DefaultView.Count-1; if(startIndex>endIndex) if(endIndex+1>PageSize) { startIndex=0; endIndex=PageSize-1; } else { startIndex=0; //endIndex is same } for(int rowIndex=startIndex ; rowIndex<=endIndex ; rowIndex++) { row=new TableRow(); //first column cell=new TableCell(); cell.CssClass="tbl1_chk"; cell.Visible=false; if(EnableCheckBoxes==true) { cell.Visible=true; //string primaryKeyString=string.Join(_primaryKeySeparator, this.PrimaryKeyColumnArray); string primaryKeyValue=""; for(int i=0;i<this.PrimaryKeyColumnArray.Length;i++) { if(i!=0) primaryKeyValue+=_primaryKeySeparator; primaryKeyValue+=DataSource.DefaultView[rowIndex][this.PrimaryKeyColumnArray[i].ToString()].ToString(); } if(EnableMultipleSelection==false) { radio=new HtmlInputRadioButton(); radio.Name="chk_"; radio.Value=primaryKeyValue; radio.EnableViewState=false; cell.Controls.Add(radio); } else { chkbox=new HtmlInputCheckBox(); chkbox.Name=this.UniqueID; chkbox.Value=primaryKeyValue; chkbox.ID="chk_" + rowIndex.ToString(); chkbox.EnableViewState=false; cell.Controls.Add(chkbox); } } row.Cells.Add(cell); for(int i=0;i<this.ColumnNameArray.Length;i++) { string columnName=this.ColumnNameArray[i]; int columnWidth=this.ColumnWidthArray[i]; if (columnWidth<=0) { continue; //we're not displaying curDSColumn } cell=new TableCell(); cell.CssClass="tbl1_item"; CreateTableCell(cell , columnName , rowIndex , DataSource.DefaultView[rowIndex].Row); row.Cells.Add(cell); } GridTable.Rows.Add(row); } }
protected void rptList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { //美化导航树结构 Literal LitFirst = (Literal)e.Item.FindControl("LitFirst"); HiddenField hidLayer = (HiddenField)e.Item.FindControl("hidLayer"); string LitStyle = "<span style=\"display:inline-block;width:{0}px;\"></span>{1}{2}"; string LitImg1 = "<span class=\"folder-open\"></span>"; string LitImg2 = "<span class=\"folder-line\"></span>"; Repeater rck = (Repeater)e.Item.FindControl("rck"); int classLayer = Convert.ToInt32(hidLayer.Value); if (classLayer == 1) { LitFirst.Text = LitImg1; } else { LitFirst.Text = string.Format(LitStyle, (classLayer - 2) * 24, LitImg2, LitImg1); } //绑定导航权限资源 string[] actionTypeArr = ((HiddenField)e.Item.FindControl("hidActionType")).Value.Split(','); //CheckBoxList cblActionType = (CheckBoxList)e.Item.FindControl("cblActionType"); Label lbshow = (Label)e.Item.FindControl("lbshow"); Label lbshow2 = (Label)e.Item.FindControl("lbshow2"); Label lbshow3 = (Label)e.Item.FindControl("lbshow3"); Label lbshow4 = (Label)e.Item.FindControl("lbshow4"); Label lbshow5 = (Label)e.Item.FindControl("lbshow5"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)e.Item.FindControl("checkbox5"); checkbox1.Visible = false; checkbox2.Visible = false; checkbox3.Visible = false; checkbox4.Visible = false; checkbox5.Visible = false; //cblActionType.Items.Clear(); for (int i = 0; i < actionTypeArr.Length; i++) { //if (Utils.ActionType().ContainsKey(actionTypeArr[i])) //{ // cblActionType.Items.Add(new ListItem(" " + Utils.ActionType()[actionTypeArr[i]] + " ", actionTypeArr[i])); //} if (i == 0) { lbshow.Text = Utils.ActionType()[actionTypeArr[0]]; checkbox1.Visible = true; } if (i == 1) { lbshow2.Text = Utils.ActionType()[actionTypeArr[1]]; checkbox2.Visible = true; } if (i == 2) { lbshow3.Text = Utils.ActionType()[actionTypeArr[2]]; checkbox3.Visible = true; } if (i == 3) { lbshow4.Text = Utils.ActionType()[actionTypeArr[3]]; checkbox4.Visible = true; } if (i == 4) { lbshow5.Text = Utils.ActionType()[actionTypeArr[4]]; checkbox5.Visible = true; } } } }
private void DeleteInfo() { 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<ESHOP_MAIL_RECIVE>().Where(g => items.Contains(g.MAIL_ID)); DB.ESHOP_MAIL_RECIVEs.DeleteAllOnSubmit(g_delete); DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { items = null; SearchResult(); } }
protected void Lbhien_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++; } var list = DB.ESHOP_MAIL_RECIVEs.Where(g => items.Contains(g.MAIL_ID)).ToList(); foreach (var i1 in list) { i1.MAIL_ACTIVE = 1; DB.SubmitChanges(); } SearchResult(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
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(); }
void SetCheckedBoxChecked(TextBox txt, System.Web.UI.HtmlControls.HtmlInputCheckBox chk) { //if (txt.Text == "N/A") chk.Checked = true; chk.Checked = (txt.Text == "N/A" ? true : false); txt.Enabled = (chk.Checked ? false : true); }
public void InstantiateIn(System.Web.UI.Control container) { PlaceHolder ph = new PlaceHolder(); LinkButton lnk = new LinkButton(); //欄位標題 Literal l_trID = new Literal(); //內容tr的ID System.Web.UI.HtmlControls.HtmlInputCheckBox chk = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); //每一行的checkbox Literal l_javascript = new Literal(); //每一行按下去的javascript Literal l = new Literal(); //每一個td的內容 string td_Class = ""; if (IsUseBorder) { td_Class = "Cell_Border"; } else { td_Class = "Cell"; } switch (templateType) { case myListItemType_Button.Header: ph.Controls.Add(new LiteralControl("<table id='tb_ListView' class='table table-striped table-bordered table-hover table-nowrap' >")); ph.Controls.Add(new LiteralControl("<thead> <tr>")); if (IsUseCheckBox) { ph.Controls.Add(new LiteralControl("<th >")); ph.Controls.Add(new LiteralControl("</th>")); } for (int i = 0; i < ListViewCollumns.Count; i++) { ph.Controls.Add(new LiteralControl("<TH ")); if (!string.IsNullOrEmpty(ListViewCollumns[i].Width)) { ph.Controls.Add(new LiteralControl(" width=" + ListViewCollumns[i].Width)); } ph.Controls.Add(new LiteralControl(" >")); lnk = new LinkButton(); lnk.CommandName = "Sort"; lnk.CommandArgument = ListViewCollumns[i].SourceName; lnk.Text = ListViewCollumns[i].TitleName; ph.Controls.Add(lnk); ph.Controls.Add(new LiteralControl("</TH>")); } if (OnClickExecFunc != "") { ph.Controls.Add(new LiteralControl("<th >")); ph.Controls.Add(new LiteralControl(" ")); ph.Controls.Add(new LiteralControl("</th>")); } ph.Controls.Add(new LiteralControl("</tr></thead>")); //標題尾 ph.Controls.Add(new LiteralControl("<tfoot><tr>")); if (IsUseCheckBox) { ph.Controls.Add(new LiteralControl("<th >")); ph.Controls.Add(new LiteralControl("")); ph.Controls.Add(new LiteralControl("</th>")); } for (int i = 0; i < ListViewCollumns.Count; i++) { ph.Controls.Add(new LiteralControl("<th aligh='center' ")); if (!string.IsNullOrEmpty(ListViewCollumns[i].Width)) { ph.Controls.Add(new LiteralControl(" width=" + ListViewCollumns[i].Width)); } ph.Controls.Add(new LiteralControl(">")); lnk = new LinkButton(); lnk.CommandName = "Sort"; lnk.CommandArgument = ListViewCollumns[i].SourceName; lnk.Text = ListViewCollumns[i].TitleName; ph.Controls.Add(lnk); ph.Controls.Add(new LiteralControl("</th>")); } if (OnClickExecFunc != "") { ph.Controls.Add(new LiteralControl("<th >")); ph.Controls.Add(new LiteralControl(" ")); ph.Controls.Add(new LiteralControl("</th>")); } ph.Controls.Add(new LiteralControl("</tr></tfoot>")); PlaceHolder p = new PlaceHolder(); p.ID = "itemPlaceholder"; ph.Controls.Add(p); ph.Controls.Add(new LiteralControl("</table>")); // ph.Controls.Add(new LiteralControl("</div>")); break; case myListItemType_Button.Item: l_trID.ID = "_tr"; ph.Controls.Add(new LiteralControl("<tr ")); ph.Controls.Add(l_trID); if (TRTitle != "") { ph.Controls.Add(new LiteralControl(" title='" + TRTitle + "' ")); } ph.Controls.Add(new LiteralControl(">")); if (IsUseCheckBox) { chk = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chk.ID = "chk"; ph.Controls.Add(new LiteralControl("<td ")); if (IsUseBorder) { ph.Controls.Add(new LiteralControl("class='CheckCell_Border' ")); } ph.Controls.Add(new LiteralControl("align='center'>")); ph.Controls.Add(chk); ph.Controls.Add(new LiteralControl("</td>")); } for (int i = 0; i < ListViewCollumns.Count; i++) { //按鈕處理 if (ListViewCollumns[i].TypeButton != null) { ph.Controls.Add(new LiteralControl(" <td align='" + ListViewCollumns[i].Align + "' + >")); ph.Controls.Add(new LiteralControl(" <input ")); l_javascript = new Literal(); l_javascript.ID = "_funonclickButton" + i; //onclick ph.Controls.Add(l_javascript); ph.Controls.Add(new LiteralControl(" >")); ph.Controls.Add(new LiteralControl(" </input>")); } else { ph.Controls.Add(new LiteralControl("<td align='" + ListViewCollumns[i].Align + "' ")); ph.Controls.Add(new LiteralControl(">")); ph.Controls.Add(new LiteralControl("<span style='white-space: normal;'>")); l = new Literal(); l.ID = "_item" + ListViewCollumns[i].SourceName; ph.Controls.Add(l); ph.Controls.Add(new LiteralControl("</span>")); } ph.Controls.Add(new LiteralControl("</td>")); } if (OnClickExecFunc != "") { ph.Controls.Add(new LiteralControl("<td >")); ph.Controls.Add(new LiteralControl("<a id='edit-row' name='edit-row' class='green' href='#' ")); l_javascript = new Literal(); l_javascript.ID = "_funonclick"; ph.Controls.Add(l_javascript); ph.Controls.Add(new LiteralControl(" ><i class='ace-icon fa fa-edit bigger-130'></i></a>")); ph.Controls.Add(new LiteralControl("</td>")); } ph.Controls.Add(new LiteralControl("</tr>")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case myListItemType_Button.AlternatingItem: l_trID.ID = "_tr"; ph.Controls.Add(new LiteralControl("<tr ")); ph.Controls.Add(l_trID); if (TRTitle != "") { ph.Controls.Add(new LiteralControl(" title='" + TRTitle + "' ")); } ph.Controls.Add(new LiteralControl(">")); if (IsUseCheckBox) { chk = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chk.ID = "chk"; ph.Controls.Add(new LiteralControl("<td ")); if (IsUseBorder) { ph.Controls.Add(new LiteralControl("class='CheckCell_Border' ")); } ph.Controls.Add(new LiteralControl("align='center'>")); ph.Controls.Add(chk); ph.Controls.Add(new LiteralControl("</td>")); } for (int i = 0; i < ListViewCollumns.Count; i++) { //按鈕處理 if (ListViewCollumns[i].TypeButton != null) { ph.Controls.Add(new LiteralControl(" <td align='" + ListViewCollumns[i].Align + "' + >")); ph.Controls.Add(new LiteralControl(" <input ")); l_javascript = new Literal(); l_javascript.ID = "_funonclickButton" + i; //onclick ph.Controls.Add(l_javascript); ph.Controls.Add(new LiteralControl(" >")); ph.Controls.Add(new LiteralControl(" </input>")); } else { ph.Controls.Add(new LiteralControl("<td align='" + ListViewCollumns[i].Align + "' ")); ph.Controls.Add(new LiteralControl(">")); l = new Literal(); l.ID = "_item" + ListViewCollumns[i].SourceName; ph.Controls.Add(l); } ph.Controls.Add(new LiteralControl("</td>")); } if (OnClickExecFunc != "") { ph.Controls.Add(new LiteralControl("<td >")); ph.Controls.Add(new LiteralControl("<a id='edit-row' name='edit-row' class='green' href='#' ")); l_javascript = new Literal(); l_javascript.ID = "_funonclick"; ph.Controls.Add(l_javascript); ph.Controls.Add(new LiteralControl(" ><i class='ace-icon fa fa-edit bigger-130'></i></a>")); ph.Controls.Add(new LiteralControl("</td>")); } ph.Controls.Add(new LiteralControl("</tr>")); ph.DataBinding += new EventHandler(Item_DataBinding); break; case myListItemType_Button.Footer: ph.Controls.Add(new LiteralControl("</table>")); break; case myListItemType_Button.EmptyData: int td_colspan = ListViewCollumns.Count; ph.Controls.Add(new LiteralControl("<table id='tb_ListView' cellspacing=0 cellpadding=0 style='border-top:GRAY 1PX SOLID;width:100%;'><tr>")); if (IsUseCheckBox) { ph.Controls.Add(new LiteralControl("<td >")); ph.Controls.Add(new LiteralControl("<input id='chkAll' type='checkbox' disabled />")); ph.Controls.Add(new LiteralControl("</td>")); td_colspan++; } for (int i = 0; i < ListViewCollumns.Count; i++) { ph.Controls.Add(new LiteralControl("<td ")); if (!string.IsNullOrEmpty(ListViewCollumns[i].Width)) { ph.Controls.Add(new LiteralControl(" width=" + ListViewCollumns[i].Width)); } ph.Controls.Add(new LiteralControl(">")); ph.Controls.Add(new LiteralControl(ListViewCollumns[i].TitleName + "</td>")); } ph.Controls.Add(new LiteralControl("</tr>")); ph.Controls.Add(new LiteralControl("<tr><td class='Cell' colspan='" + td_colspan.ToString() + "'><font color='red'>無資料符合搜尋條件,請重新設定搜尋條件</font></td></tr>")); ph.Controls.Add(new LiteralControl("</table>")); break; } container.Controls.Add(ph); }
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]); 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_NEW>().Where(g => items.Contains(g.NEWS_ID)); DB.ESHOP_NEWs.DeleteAllOnSubmit(g_delete); DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { items = null; SearchResult(); } }
private void SaveAdItemsCat(int AdItem_Id) { try { var gcdel = (from gp in DB.ESHOP_AD_ITEM_CATs where gp.AD_ITEM_ID == AdItem_Id select gp); DB.ESHOP_AD_ITEM_CATs.DeleteAllOnSubmit(gcdel); for (int i = 0; i < Rplistcate.Items.Count; i++) { HtmlInputCheckBox 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_AD_ITEM_CAT grinsert = new ESHOP_AD_ITEM_CAT(); grinsert.CAT_ID = _catid; grinsert.AD_ITEM_ID = AdItem_Id; DB.ESHOP_AD_ITEM_CATs.InsertOnSubmit(grinsert); } } } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
private bool DoEdit(int _id) { bool result = false; Cms.BLL.C_admin_role bll = new Cms.BLL.C_admin_role(); Cms.Model.C_admin_role model = bll.GetModel(_id); model.role_name = txtRoleName.Text.Trim(); model.role_type = int.Parse(ddlRoleType.SelectedValue); //管理权限 Cms.BLL.C_admin_role_value bllrole_value = new Cms.BLL.C_admin_role_value(); Cms.Model.C_admin_role_value modelrole_value = new Cms.Model.C_admin_role_value(); bllrole_value.DeleteList("role_id=" + _id); for (int i = 0; i < rptList.Items.Count; i++) { string navName = ((HiddenField)rptList.Items[i].FindControl("hidName")).Value; //CheckBoxList cblActionType = (CheckBoxList)rptList.Items[i].FindControl("cblActionType"); //for (int n = 0; n < cblActionType.Items.Count; n++) //{ // if (cblActionType.Items[n].Selected == true) // { // modelrole_value.role_id = _id; // modelrole_value.nav_name = navName; // modelrole_value.action_type = cblActionType.Items[n].Value; // bllrole_value.Add(modelrole_value); // } //} System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox1 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox1"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox2 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox2"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox3 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox3"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox4 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox4"); System.Web.UI.HtmlControls.HtmlInputCheckBox checkbox5 = (System.Web.UI.HtmlControls.HtmlInputCheckBox)rptList.Items[i].FindControl("checkbox5"); string[] actionTypeArr = ((HiddenField)rptList.Items[i].FindControl("hidActionType")).Value.Split(','); string str = ""; if (checkbox1.Checked == true) { str += actionTypeArr[0] + ","; } if (checkbox2.Checked == true) { str += actionTypeArr[1] + ","; } if (checkbox3.Checked == true) { str += actionTypeArr[2] + ","; } if (checkbox4.Checked == true) { str += actionTypeArr[3] + ","; } if (checkbox5.Checked == true) { str += actionTypeArr[4] + ","; } if (str.Length > 0) { str = str.Substring(0, str.Length - 1); modelrole_value.role_id = _id; modelrole_value.nav_name = navName; modelrole_value.action_type = str; bllrole_value.Add(modelrole_value); } } if (bll.Update(model)) { adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.role_name); //记录日志 result = true; } return(result); }
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<ESHOP_PROPERTy>().Where(g => items.Contains(Convert.ToInt32(g.PROP_ID))); DB.ESHOP_PROPERTies.DeleteAllOnSubmit(g_delete); DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { items = null; SearchResult(); } }
/// <summary> /// 将指定的 TableCell 对象初始化为指定的行状态。 /// </summary> /// <param name="cell">要初始化的 TableCell。</param> /// <param name="rowState">DataControlRowState<see cref="DataControlRowState"/> 值之一。</param> protected override void InitializeDataCell(DataControlFieldCellEx cell, DataGridViewRowState rowState) { HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = string.Format("{0}_cbSelect", ((DataGridView)this.Control).ClientID); Control dataBindingContainer = (Control)cb; dataBindingContainer.DataBinding += this.OnDataBindField; cell.Controls.Add(cb); }
private void SaveGroupCat(int GroupId) { try { int i = 0; HtmlInputCheckBox check = new HtmlInputCheckBox(); var gcdel = (from gp in DB.ESHOP_GROUP_CATs where gp.GROUP_ID == GroupId select gp); DB.ESHOP_GROUP_CATs.DeleteAllOnSubmit(gcdel); foreach (DataGridItem item in GridItemList.Items) { check = new HtmlInputCheckBox(); check = (HtmlInputCheckBox)item.Cells[1].FindControl("chkSelect"); if (check.Checked) { ESHOP_GROUP_CAT grinsert = new ESHOP_GROUP_CAT(); grinsert.CAT_ID=Utils.CIntDef(GridItemList.DataKeys[i]); grinsert.GROUP_ID = GroupId; DB.ESHOP_GROUP_CATs.InsertOnSubmit(grinsert); } i++; } //DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } }
/// <summary> /// 将指定的 TableCell 对象初始化为指定的行状态。 /// </summary> /// <param name="cell">要初始化的 TableCell。</param> /// <param name="cellType">DataControlCellType<see cref="DataControlCellType"/> 值之一。</param> /// <param name="rowState">DataControlRowState<see cref="DataControlRowState"/> 值之一。</param> /// <param name="rowIndex">从零开始的行索引。</param> public override void InitializeCell(DataControlFieldCellEx cell, DataControlCellType cellType, DataGridViewRowState rowState, int rowIndex) { base.InitializeCell(cell, cellType, rowState, rowIndex); DataGridView owner = this.Control as DataGridView; if (owner == null) return; else if (cellType == DataControlCellType.Header) { ClientScriptManager scriptManager = owner.Page.ClientScript; string scriptKey = string.Format("{0}_SelectAll", owner.ClientID); if (!scriptManager.IsClientScriptBlockRegistered(this.GetType(), scriptKey)) { StringBuilder sb = new StringBuilder(); sb.Append("<script type=\"text/javascript\">\r\n"); sb.AppendFormat("function {0}_SelectAll()\r\n", owner.ClientID); sb.Append("{\r\n"); sb.AppendFormat("\tvar c=document.all.{0}_cbSelectAll.checked;\r\n", owner.ClientID); sb.AppendFormat("\tvar cb=document.all.{0}.getElementsByTagName(\"input\");\r\n", owner.ClientID); sb.Append("\tif(cb && cb!=null)\r\n"); sb.Append("\t{\r\n"); sb.Append("\t\tfor(var i=0;i<cb.length;i++)\r\n"); sb.Append("\t\t{\r\n"); sb.AppendFormat("\t\t\tif(cb[i].type==\"checkbox\" && cb[i].id.indexOf(\"{0}\")>-1)\r\n", owner.ClientID); sb.Append("\t\t\t{\r\n"); sb.Append("\t\t\tcb[i].checked=c;\r\n"); sb.Append("\t\t\t}\r\n"); sb.Append("\t\t}\r\n"); sb.Append("\t}\r\n"); sb.Append("}\r\n"); sb.Append("</script>\r\n"); scriptManager.RegisterClientScriptBlock(this.GetType(), scriptKey, sb.ToString()); } HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.Attributes["ID"] = string.Format("{0}_cbSelectAll", owner.ClientID); cb.Attributes["onclick"] = string.Format("javascript:{0}_SelectAll()", owner.ClientID); cell.Controls.Add(cb); } }
void _cleared(TextBox txt, System.Web.UI.HtmlControls.HtmlInputCheckBox chk) { txt.Enabled = (chk.Checked ? false : true); }
private void CreateMemHierarchy(short AxisOrdinal, HtmlTable hostTable , Member mem, bool HierIsAggregated , byte TreeDepth, bool autoSelect) { //do not display aggregate, display undlying calc members instead if(HierIsAggregated==true && mem.UniqueName==mem.Hierarchy.FilterMember.UniqueName) { MembersAggregate maggr=mem.Hierarchy.FilterMember as MembersAggregate; if(maggr!=null) { for(int i=0;i<maggr.Members.Count;i++) { CalculatedMember cmem=maggr.Members[i] as CalculatedMember; if(cmem!=null) this.CreateMemHierarchy(AxisOrdinal, hostTable, cmem, HierIsAggregated, TreeDepth, false); // recursion } } return; } string memIdentifier=_contr.IdentifierFromSchemaMember(mem); string hierIdentifier=mem.Hierarchy.Axis.Ordinal.ToString() + ":" + mem.Hierarchy.Ordinal.ToString(); bool memIsSelected=false; bool memIsOpen=false; bool memIsPlaceholder=false; bool memAutoSelectChildren=(mem.Hierarchy.CalculatedMembers.GetMemberChildrenSet(mem.UniqueName)!=null); SchemaMember smem=mem as SchemaMember; if(smem!=null) { memIsOpen=smem.IsOpen; memIsPlaceholder=smem.IsPlaceholder; } if(HierIsAggregated) memIsSelected=(((MembersAggregate)mem.Hierarchy.FilterMember).Members[mem.UniqueName]!=null?true:false); else memIsSelected=(mem.Hierarchy.GetMember(mem.UniqueName)!=null); HtmlTableRow tr=new HtmlTableRow(); HtmlTableCell td; System.Web.UI.WebControls.Button btn; Literal lit; // --- node contr col-- td= new HtmlTableCell(); td.Attributes.Add("class","sel_C1"); td.NoWrap=true; tr.Cells.Add(td); // --- node name col-- td= new HtmlTableCell(); lit=new Literal(); for(int i=0;i<TreeDepth;i++) lit.Text=lit.Text + " "; td.Controls.Add(lit); if(memIsOpen) { btn=new System.Web.UI.WebControls.Button(); btn.ToolTip="Close"; btn.ID="sel_close:" + memIdentifier; btn.CssClass="sel_close"; td.Controls.Add(btn); } else { if(mem.CanDrillDown) { btn=new System.Web.UI.WebControls.Button(); btn.ToolTip="Open"; btn.ID="sel_open:"+memIdentifier; btn.CssClass="sel_open"; td.Controls.Add(btn); } else { // no image lit.Text=lit.Text + " "; } } if(memIsPlaceholder==false) if(AxisOrdinal==2 && HierIsAggregated==false) { HtmlInputRadioButton radio=new HtmlInputRadioButton(); radio.Name="m:" + hierIdentifier; radio.ID="m:" + memIdentifier; radio.EnableViewState=false; radio.Checked=(memIsSelected || autoSelect); radio.Disabled=autoSelect; radio.Attributes.Add("class" , "sel_chk"); td.Controls.Add(radio); } else { HtmlInputCheckBox chk=new HtmlInputCheckBox(); chk.ID="m:" + mem.UniqueName; //note, UniqueName ! chk.EnableViewState=false; chk.Checked=(memIsSelected || autoSelect); chk.Disabled=autoSelect; chk.Attributes.Add("class" , "sel_chk"); td.Controls.Add(chk); } lit=new Literal(); lit.Text=mem.Name; td.Controls.Add(lit); td.Attributes.Add("class","sel_C"); td.NoWrap=true; tr.Cells.Add(td); // --- node select col-- td= new HtmlTableCell(); if(AxisOrdinal!=2 && memIsOpen) { if(!memAutoSelectChildren) { btn=new System.Web.UI.WebControls.Button(); btn.ToolTip="Auto-Select Children"; btn.ID="sel_selauto:"+memIdentifier; btn.CssClass="sel_selauto"; td.Controls.Add(btn); btn=new System.Web.UI.WebControls.Button(); btn.ToolTip="Select Children"; btn.ID="sel_selall:"+memIdentifier; btn.CssClass="sel_selall"; td.Controls.Add(btn); } btn=new System.Web.UI.WebControls.Button(); btn.ToolTip ="Deselect All Children"; btn.ID="sel_deselall:"+memIdentifier; btn.CssClass="sel_deselall"; td.Controls.Add(btn); } td.Attributes.Add("class","sel_C2"); td.NoWrap=true; tr.Cells.Add(td); hostTable.Rows.Add(tr); if(memIsOpen==false) return; // next level members if it's schema member TreeDepth++; if(smem!=null) { for(int j=0;j<smem.Children.Count;j++) CreateMemHierarchy(AxisOrdinal, hostTable, smem.Children[j] , HierIsAggregated , TreeDepth, memAutoSelectChildren); } }