//------------------------------------------------------------------- protected void Page_Init(object sender, EventArgs e) { _label = new System.Web.UI.WebControls.Label { ID = ID + "label"}; Controls.Add(_label); _textBox = new System.Web.UI.WebControls.TextBox { ID = ID + "textBox" }; Controls.Add(_textBox); }
public void RenderAsControl(Option baseOption, System.Web.UI.WebControls.PlaceHolder ph) { System.Web.UI.WebControls.TextBox result = new System.Web.UI.WebControls.TextBox(); result.ID = "opt" + baseOption.Bvin.Replace("-", ""); result.ClientIDMode = System.Web.UI.ClientIDMode.Static; string c = this.GetColumns(baseOption); if (c == "") c = "20"; string r = this.GetRows(baseOption); if (r == "") r = "1"; int rint = 1; int.TryParse(r,out rint); int cint = 20; int.TryParse(c,out cint); int mint = 255; int.TryParse(this.GetMaxLength(baseOption),out mint); result.Rows = rint; result.Columns = cint; result.MaxLength = mint; if (r != "1") { result.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine; } ph.Controls.Add(result); }
public void BindToNullable() { System.Web.UI.WebControls.TextBox textBox = new System.Web.UI.WebControls.TextBox(); textBox.Text = string.Empty; BindToNullable_TestEntity entity = new BindToNullable_TestEntity(); new SimpleExpressionBinding("Text", "SortOrder").BindSourceToTarget(textBox, entity, null); Assert.IsNull(entity.SortOrder); }
protected override void CreateChildControls() { base.CreateChildControls(); _innerTbx = new System.Web.UI.WebControls.TextBox(); this.Controls.Add(_innerTbx); _innerList = new System.Web.UI.WebControls.ListBox(); FillTimes(); Controls.Add(_innerList); }
public DataLoader( string strPath , System.Web.UI.WebControls.TextBox tbStatusParam , System.Web.UI.WebControls.Label lblErrorParam , System.Web.UI.HtmlControls.HtmlGenericControl OpenCSVListParam) { strAppPath = strPath; //Request.PhysicalApplicationPath tbStatus = tbStatusParam; lblError = lblErrorParam; objDB = new DBAccess(); objDB.ErrorLabel = lblErrorParam; Company2SFUtils.OpenCSVList = OpenCSVListParam; }
protected override void CreateChildControls() { tb = new System.Web.UI.WebControls.TextBox(); tb.ID = "tb" + this.ID; tb.CssClass = "text"; //this.Controls.Add(tb); ca = new CalendarExtender(); DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat; ca.Format = di.ShortDatePattern; ca.TargetControlID = tb.ID; ca.ID = "ce" + this.ID; //this.Controls.Add(ca); hf = new System.Web.UI.WebControls.HiddenField(); hf.ID = "hidden" + this.ID; cal = new System.Web.UI.WebControls.Calendar(); cal.ID = "cal" + this.ID; cal.CssClass = "calendar"; cal.SelectionChanged += new EventHandler(cal_SelectionChanged); //this.Controls.Add(cal); }
public static void AddNumDec(System.Web.UI.WebControls.TextBox sourceObject, Byte intCasas) { sourceObject.Attributes.Add("onKeyPress", String.Format("javascript:{0}", StringApenasNumDec(intCasas.ToString()))); }
public static void AddMaskText(System.Web.UI.WebControls.TextBox textObject, string maskText) { textObject.Attributes.Add("onKeyPress", String.Format("javascript:{0}", ScriptMaskText(maskText))); textObject.Attributes.Add("MaxLength", maskText.ToString().Length.ToString()); }
public void Add() { var file = Constant.Request.Files[0]; string path = Constant.Request["currentpath"]; var parant = -1; if (path.IsNotNullOrEmpty()) { parant = Convert.ToInt32(path); } if (parant == -1) { path = "~/client/" + RoolFolder; } else { path = "~/client/" + _fileServices.GetFolderById(parant).Url; } var count = _fileServices.GetFileByName(Folder, file.FileName).Count(); var name = file.FileName; if (count > 0) { name = name + "(" + (count + 1) + ")"; } var saveUrl = Constant.Server.MapPath(path) + "\\" + name; file.SaveAs(saveUrl); var mFile = new MFile(); mFile.Url = path + "\\" + name; mFile.Name = name; mFile.Createtime = DateTime.UtcNow; mFile.Updatetime = DateTime.UtcNow; mFile.Folder = parant; mFile.User = User; mFile.Role = GetRole(); mFile.FileType = Path.GetExtension(name).Replace(".", "").ToLower(); var info = new FileInfo(saveUrl); mFile.Size = info.Length; _fileServices.AddFile(mFile); var response = new FileManageResponse() { Error = "No error", Name = Path.GetFileName(name), Path = parant.ToString() }.SerializeObject(); Constant.Response.ContentType = "text/html"; Constant.Response.ContentEncoding = Encoding.UTF8; System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox(); txt.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine; txt.Text = response; StringWriter sw = new StringWriter(); System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(sw); txt.RenderControl(writer); Constant.Response.Write(sw.ToString() ); }
public void ProcessRequest(HttpContext context) { context.Response.ClearHeaders(); context.Response.ClearContent(); context.Response.Clear(); switch (context.Request["mode"]) { case "getinfo": context.Response.ContentType = "plain/text"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(getInfo(context.Request["path"])); break; case "getfolder": context.Response.ContentType = "plain/text"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(getFolderInfo(context.Request["path"])); break; case "rename": context.Response.ContentType = "plain/text"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(Rename(context.Request["old"], context.Request["new"])); break; case "delete": context.Response.ContentType = "plain/text"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(Delete(context.Request["path"])); break; case "addfolder": context.Response.ContentType = "plain/text"; context.Response.ContentEncoding = Encoding.UTF8; context.Response.Write(AddFolder(context.Request["path"], context.Request["name"])); break; case "download": FileInfo fi = new FileInfo(context.Server.MapPath(context.Request["path"])); context.Response.AddHeader("Content-Disposition", "attachment; filename=" + context.Server.UrlPathEncode(context.Request["path"])); context.Response.AddHeader("Content-Length", fi.Length.ToString()); context.Response.ContentType = "application/octet-stream"; context.Response.TransmitFile(fi.FullName); break; case "add": System.Web.HttpPostedFile file = context.Request.Files[0]; string path = context.Request["currentpath"]; file.SaveAs(context.Server.MapPath(Path.Combine(path, Path.GetFileName(file.FileName)))); context.Response.ContentType = "text/html"; context.Response.ContentEncoding = Encoding.UTF8; StringBuilder sb = new StringBuilder(); sb.AppendLine("{"); sb.AppendLine("\"Path\": \"" + path + "\","); sb.AppendLine("\"Name\": \"" + Path.GetFileName(file.FileName) + "\","); sb.AppendLine("\"Error\": \"No error\","); sb.AppendLine("\"Code\": 0"); sb.AppendLine("}"); System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox(); txt.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine; txt.Text = sb.ToString(); StringWriter sw = new StringWriter(); System.Web.UI.HtmlTextWriter writer = new System.Web.UI.HtmlTextWriter(sw); txt.RenderControl(writer); context.Response.Write(sw.ToString()); break; default: break; } }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { string Mode = Request.QueryString["Mode"].ToString(); OperationResult objOperationResult = new OperationResult(); _protocolcomponentListDTO = new List <protocolcomponentDto>(); _protocolDTO = new protocolDto(); var id = cbOrganization.SelectedValue.ToString().Split('|'); var id1 = cbOrganizationInvoice.SelectedValue.ToString().Split('|'); var id2 = cbIntermediaryOrganization.SelectedValue.ToString().Split('|'); _protocolDTO.v_Name = txtProtocolName.Text; _protocolDTO.v_EmployerOrganizationId = id[0]; _protocolDTO.v_EmployerLocationId = id[1]; _protocolDTO.i_EsoTypeId = int.Parse(cbEsoType.SelectedValue.ToString()); _protocolDTO.v_GroupOccupationId = cbGeso.SelectedValue.ToString(); _protocolDTO.v_CustomerOrganizationId = id1[0]; _protocolDTO.v_CustomerLocationId = id1[1]; _protocolDTO.v_WorkingOrganizationId = id2[0]; _protocolDTO.v_WorkingLocationId = cbIntermediaryOrganization.SelectedValue.ToString() != "-1" ? id2[1] : "-1"; _protocolDTO.i_MasterServiceId = int.Parse(cbService.SelectedValue.ToString()); _protocolDTO.v_CostCenter = txtCostCenter.Text; _protocolDTO.i_MasterServiceTypeId = int.Parse(cbServiceType.SelectedValue.ToString()); _protocolDTO.i_HasVigency = 0; _protocolDTO.i_ValidInDays = 0; _protocolDTO.i_IsActive = 1; _protocolDTO.v_NombreVendedor = ""; if (Mode == "New") { if (IsExistsProtocolName()) { Alert.Show("Este protocolo ya existe"); return; } CheckBoxField field1 = (CheckBoxField)grdData.FindColumn("CheckBoxField2"); for (int i = 0; i < grdData.Rows.Count; i++) { if (field1.GetCheckedState(i) == true) { _protocolDTO.v_ProtocolId = null; GridRow row = grdData.Rows[i]; System.Web.UI.WebControls.TextBox txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("r_Price"); protocolcomponentDto protocolComponent = new protocolcomponentDto(); protocolComponent.v_ComponentId = grdData.Rows[i].Values[5]; protocolComponent.r_Price = float.Parse(txtPrice.Text.ToString());// float.Parse(grdData.Rows[i].Values[4].ToString()); //protocolComponent.i_OperatorId = -1; //protocolComponent.i_Age = 0; //protocolComponent.i_GenderId = 3; //protocolComponent.i_IsAdditional = 0; //protocolComponent.i_IsConditionalId =0; System.Web.UI.WebControls.TextBox txtEdad = (System.Web.UI.WebControls.TextBox)row.FindControl("i_Age"); CheckBoxField fieldAdicional = (CheckBoxField)grdData.FindColumn("CheckBoxField3"); bool ChecAdicional = fieldAdicional.GetCheckedState(i); CheckBoxField fieldCondicional = (CheckBoxField)grdData.FindColumn("CheckBoxField4"); bool ChecCondicional = fieldCondicional.GetCheckedState(i); protocolComponent.i_Age = int.Parse(txtEdad.Text.ToString()); protocolComponent.i_IsAdditional = ChecAdicional == true ? 1 : 0; protocolComponent.i_IsConditionalId = ChecCondicional == true ? 1 : 0; System.Web.UI.WebControls.DropDownList ddlOperador = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlOperador"); System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlGender"); protocolComponent.i_GenderId = int.Parse(ddlGender.SelectedValue.ToString()); protocolComponent.i_OperatorId = int.Parse(ddlOperador.SelectedValue.ToString()); protocolComponent.i_IsConditionalIMC = 0; protocolComponent.r_Imc = 0; _protocolcomponentListDTO.Add(protocolComponent); } } _protocolBL.AddProtocol(ref objOperationResult, _protocolDTO, _protocolcomponentListDTO, ((ClientSession)Session["objClientSession"]).GetAsList()); } else if (Mode == "Edit") { _protocolDTO.v_ProtocolId = Session["ProtocolId"].ToString(); //Eliminar Fisicamente registros de protocolcomponent _protocolBL.EliminarProtocolComponentByProtocolId(ref objOperationResult, Session["ProtocolId"].ToString()); //Grabar de nuevo la entidad CheckBoxField field1 = (CheckBoxField)grdData.FindColumn("CheckBoxField2"); for (int i = 0; i < grdData.Rows.Count; i++) { if (field1.GetCheckedState(i) == true) { protocolcomponentDto protocolComponent = new protocolcomponentDto(); GridRow row = grdData.Rows[i]; System.Web.UI.WebControls.TextBox txtPrice = (System.Web.UI.WebControls.TextBox)row.FindControl("r_Price"); System.Web.UI.WebControls.TextBox txtEdad = (System.Web.UI.WebControls.TextBox)row.FindControl("i_Age"); CheckBoxField fieldAdicional = (CheckBoxField)grdData.FindColumn("CheckBoxField3"); bool ChecAdicional = fieldAdicional.GetCheckedState(i); CheckBoxField fieldCondicional = (CheckBoxField)grdData.FindColumn("CheckBoxField4"); bool ChecCondicional = fieldCondicional.GetCheckedState(i); System.Web.UI.WebControls.DropDownList ddlOperador = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlOperador"); System.Web.UI.WebControls.DropDownList ddlGender = (System.Web.UI.WebControls.DropDownList)grdData.Rows[i].FindControl("ddlGender"); protocolComponent.v_ComponentId = grdData.Rows[i].Values[5]; protocolComponent.r_Price = float.Parse(txtPrice.Text.ToString()); protocolComponent.i_Age = int.Parse(txtEdad.Text.ToString()); protocolComponent.i_IsAdditional = ChecAdicional == true ? 1:0; protocolComponent.i_IsConditionalId = ChecCondicional == true ? 1 : 0; protocolComponent.i_GenderId = int.Parse(ddlGender.SelectedValue.ToString()); protocolComponent.i_OperatorId = int.Parse(ddlOperador.SelectedValue.ToString()); protocolComponent.i_IsConditionalIMC = 0; protocolComponent.r_Imc = 0; _protocolcomponentListDTO.Add(protocolComponent); } } _protocolBL.AddProtocol(ref objOperationResult, _protocolDTO, _protocolcomponentListDTO, ((ClientSession)Session["objClientSession"]).GetAsList()); } //Analizar el resultado de la operación if (objOperationResult.Success == 1) // Operación sin error { // Cerrar página actual y hacer postback en el padre para actualizar PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else // Operación con error { Alert.ShowInTop("Error en operación:" + System.Environment.NewLine + objOperationResult.ExceptionMessage); // Se queda en el formulario. } }
public static void ShowMessage(Control page, TextBox txt, string msgString) { msgString = msgString.Replace("'", "\\'"); ScriptManager.RegisterStartupScript(page, page.GetType(), "MsgBox", "alert('" + msgString + "');", true); txt.Focus(); }
public static void AddOpenWindow(System.Web.UI.WebControls.TextBox sourceObject, String strPagina, String strTarget, int intWidth = 400, int intHeight = 300, String strScroll = "no", String eventName = "onClick") { sourceObject.Attributes.Add(eventName, String.Format("javascript:{0}", ScriptOpenWindow(strPagina, strTarget, intWidth, intHeight, strScroll))); }
public Text() { _control = new System.Web.UI.WebControls.TextBox(); }
protected override void CreateChildControls() { base.CreateChildControls(); _innerTbx = new System.Web.UI.WebControls.TextBox(); this.Controls.Add(_innerTbx); _innerCal = new Calendar(); _innerCal.SelectionChanged += new System.EventHandler(_innerCal_SelectionChanged); _innerCal.VisibleMonthChanged += new System.Web.UI.WebControls.MonthChangedEventHandler(_innerCal_MonthChanged); Controls.Add(_innerCal); }
static public void SetPageControl(object page, string szName, string szValue) { System.Web.UI.ControlCollection cc = null; ArrayList ret = new ArrayList(); if (page is System.Web.UI.Page) { cc = (page as System.Web.UI.Page).Controls; } else if (page is System.Web.UI.UserControl) { cc = (page as System.Web.UI.UserControl).Controls; } else { return; } GetPageAllControl(ref ret, cc); foreach (object ctrInObj in ret) { System.Web.UI.Control ctr = (System.Web.UI.Control)ctrInObj; Type controlType = ctr.GetType(); switch (controlType.ToString()) { case "System.Web.UI.WebControls.TextBox": System.Web.UI.WebControls.TextBox controlTextBoxObj = (System.Web.UI.WebControls.TextBox)ctr; if (controlTextBoxObj.ID == szName) { controlTextBoxObj.Text = szValue; } break; case "System.Web.UI.WebControls.Label": System.Web.UI.WebControls.Label controlLabelObj = (System.Web.UI.WebControls.Label)ctr; if (controlLabelObj.ID == szName) { controlLabelObj.Text = szValue; } break; case "System.Web.UI.HtmlControls.HtmlInputText": System.Web.UI.HtmlControls.HtmlInputText controlInputObj = (System.Web.UI.HtmlControls.HtmlInputText)ctr; if (controlInputObj.Name == szName || controlInputObj.Name.EndsWith("$" + szName)) { controlInputObj.Value = szValue; } break; case "System.Web.UI.HtmlControls.HtmlSelect": System.Web.UI.HtmlControls.HtmlSelect controlSelectObj = (System.Web.UI.HtmlControls.HtmlSelect)ctr; if (controlSelectObj.Name == szName || controlSelectObj.Name.EndsWith("$" + szName)) { controlSelectObj.Value = szValue; } break; case "System.Web.UI.HtmlControls.HtmlInputRadioButton": System.Web.UI.HtmlControls.HtmlInputRadioButton controlRadioButtonObj = (System.Web.UI.HtmlControls.HtmlInputRadioButton)ctr; if (controlRadioButtonObj.Name == szName || controlRadioButtonObj.Name.EndsWith("$" + szName)) { if (controlRadioButtonObj.Value == szValue) { controlRadioButtonObj.Checked = true; } else { controlRadioButtonObj.Checked = false; } } break; default: //TODO:其它控件 break; } } }
public static bool CreateAccount(string p, System.Web.UI.WebControls.TextBox textBox) { throw new NotImplementedException(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) Initialize(); string[] values = Request.QueryString.GetValues("DocumentID"); if (values == null) return; iDocumentID = System.Convert.ToInt32(values[0]); DAL.ConferenceDataSet.PaperListDataTable dataTableDocument; DAL.ConferenceDataSetTableAdapters.PaperListTableAdapter adapterDocument = new DAL.ConferenceDataSetTableAdapters.PaperListTableAdapter(); dataTableDocument = adapterDocument.GetDataByDocumentID(iDocumentID); System.Web.UI.WebControls.Table table = new System.Web.UI.WebControls.Table(); int iRows = dataTableDocument.Rows.Count; for (int i = 0; i < iRows; i++) { // System.Data.DataRow dataRow = dataTableDocument.Rows[i]; DAL.ConferenceDataSet.PaperListRow dataRow = (DAL.ConferenceDataSet.PaperListRow)dataTableDocument.Rows[i]; // Define a new Web Control Image /*System.Web.UI.WebControls.Image imgCoverImage = new System.Web.UI.WebControls.Image(); imgCoverImage.AlternateText = dr["Title"].ToString(); string strImageUrl = System.String.Format("~/ImageHandler.ashx?id={0}", documentIDParam); imgCoverImage.ImageUrl = strImageUrl; cellImage.Controls.Add(imgCoverImage);*/ // Define a new Web Control Table Row System.Web.UI.WebControls.TableRow tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellDocumentIDLabel = new System.Web.UI.WebControls.TableCell(); tableCellDocumentIDLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblDocumentID = new System.Web.UI.WebControls.Label(); lblDocumentID.Text = "DocumentID"; tableCellDocumentIDLabel.Controls.Add(lblDocumentID); tableRow.Cells.Add(tableCellDocumentIDLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellDocumentIDText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtDocumentID = new System.Web.UI.WebControls.TextBox(); txtDocumentID.Text = dataRow.DocumentID.ToString(); tableCellDocumentIDText.Controls.Add(txtDocumentID); tableRow.Cells.Add(tableCellDocumentIDText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellTitleLabel = new System.Web.UI.WebControls.TableCell(); tableCellTitleLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblTitle = new System.Web.UI.WebControls.Label(); lblTitle.Text = "Title"; tableCellTitleLabel.Controls.Add(lblTitle); tableRow.Cells.Add(tableCellTitleLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellTitleText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtTitle = new System.Web.UI.WebControls.TextBox(); txtTitle.Text = dataRow.Title.ToString(); tableCellTitleText.Controls.Add(txtTitle); tableRow.Cells.Add(tableCellTitleText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellStatusTextEnLabel = new System.Web.UI.WebControls.TableCell(); tableCellStatusTextEnLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblStatusTextEn = new System.Web.UI.WebControls.Label(); lblStatusTextEn.Text = "StatusTextEn"; tableCellStatusTextEnLabel.Controls.Add(lblStatusTextEn); tableRow.Cells.Add(tableCellStatusTextEnLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellStatusTextEnText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtStatusTextEn = new System.Web.UI.WebControls.TextBox(); if (!dataRow.IsStatusTextEnNull()) txtStatusTextEn.Text = dataRow.StatusTextEn.ToString(); else txtStatusTextEn.Text = ""; tableCellStatusTextEnText.Controls.Add(txtStatusTextEn); tableRow.Cells.Add(tableCellStatusTextEnText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellFirstNameLabel = new System.Web.UI.WebControls.TableCell(); tableCellFirstNameLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblFirstName = new System.Web.UI.WebControls.Label(); lblFirstName.Text = "FirstName"; tableCellFirstNameLabel.Controls.Add(lblFirstName); tableRow.Cells.Add(tableCellFirstNameLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellFirstNameText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtFirstName = new System.Web.UI.WebControls.TextBox(); if (!dataRow.IsFirstNameNull()) //if (!String.IsNullOrEmpty(dataRow.FirstName)) txtFirstName.Text = dataRow.FirstName; else txtFirstName.Text = ""; tableCellFirstNameText.Controls.Add(txtFirstName); tableRow.Cells.Add(tableCellFirstNameText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellLastNameLabel = new System.Web.UI.WebControls.TableCell(); tableCellLastNameLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblLastName = new System.Web.UI.WebControls.Label(); lblLastName.Text = "LastName"; tableCellLastNameLabel.Controls.Add(lblLastName); tableRow.Cells.Add(tableCellLastNameLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellLastNameText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtLastName = new System.Web.UI.WebControls.TextBox(); if (!dataRow.IsLastNameNull()) // if (String.IsNullOrEmpty(dataRow.LastName)) txtLastName.Text = dataRow.LastName; else txtLastName.Text = ""; tableCellLastNameText.Controls.Add(txtLastName); tableRow.Cells.Add(tableCellLastNameText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellEmailLabel = new System.Web.UI.WebControls.TableCell(); tableCellEmailLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblEmail = new System.Web.UI.WebControls.Label(); lblEmail.Text = "Email"; tableCellEmailLabel.Controls.Add(lblEmail); tableRow.Cells.Add(tableCellEmailLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellEmailText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtEmail = new System.Web.UI.WebControls.TextBox(); if (!dataRow.IsEmailNull()) // if (String.IsNullOrEmpty(dataRow.Email)) txtEmail.Text = dataRow.Email; else txtEmail.Text = ""; tableCellEmailText.Controls.Add(txtEmail); tableRow.Cells.Add(tableCellEmailText); table.Rows.Add(tableRow); // Define a new Web Control Table Row tableRow = new System.Web.UI.WebControls.TableRow(); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellClientFileNameLabel = new System.Web.UI.WebControls.TableCell(); tableCellClientFileNameLabel.Style["text-align"] = "right;"; System.Web.UI.WebControls.Label lblClientFileName = new System.Web.UI.WebControls.Label(); lblClientFileName.Text = "ClientFileName"; tableCellClientFileNameLabel.Controls.Add(lblClientFileName); tableRow.Cells.Add(tableCellClientFileNameLabel); // Define a new Web Control Table Cell System.Web.UI.WebControls.TableCell tableCellClientFileNameText = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.TextBox txtClientFileName = new System.Web.UI.WebControls.TextBox(); if (!dataRow.IsClientFileNameNull()) // if (String.IsNullOrEmpty(dataRow.ClientFileName)) txtClientFileName.Text = dataRow.ClientFileName; else txtClientFileName.Text = ""; tableCellClientFileNameText.Controls.Add(txtClientFileName); tableRow.Cells.Add(tableCellClientFileNameText); table.Rows.Add(tableRow); /* System.Web.UI.WebControls.HyperLink hlnkBookName = new System.Web.UI.WebControls.HyperLink(); hlnkBookName.Text = dr["Title"].ToString(); hlnkBookName.NavigateUrl = "~/BookDetails.aspx?pBookID=" + System.Convert.ToString(dr["TitleID"].ToString()); cellProp.Controls.Add(hlnkBookName); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblAuthors = new System.Web.UI.WebControls.Label(); lblAuthors.Text = "Authors: "; cellProp.Controls.Add(lblAuthors); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); if (!(dr["Authors"] == null || dr.IsNull("Authors"))) { doc.LoadXml((string)dr["Authors"]); System.Xml.XmlElement root = doc.DocumentElement; // System.Xml.XmlNode root = doc.FirstChild; //Display the contents of the child nodes. if (root.HasChildNodes) for (int iIndex = 0; iIndex < root.ChildNodes.Count; iIndex++) { System.Xml.XmlNode xmlNodeAuthor = root.ChildNodes[iIndex]; System.Xml.XmlElement xmlElementAuthorID = xmlNodeAuthor["AuthorID"]; System.Xml.XmlElement xmlElementAuthorName = xmlNodeAuthor["AuthorName"]; System.Web.UI.WebControls.HyperLink hlnkAuthor = new System.Web.UI.WebControls.HyperLink(); hlnkAuthor.Text = xmlElementAuthorName.InnerText; hlnkAuthor.NavigateUrl = "~/Author.aspx?pAuthorID=" + xmlElementAuthorID.InnerText; cellProp.Controls.Add(hlnkAuthor); cellProp.Controls.Add(new System.Web.UI.LiteralControl(" ")); } } cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblTrabslator = new System.Web.UI.WebControls.Label(); lblTrabslator.Text = "Translators: "; cellProp.Controls.Add(lblTrabslator); if (!(dr["Translators"] == null || dr.IsNull("Translators"))) { doc.LoadXml((string)dr["Translators"]); System.Xml.XmlElement root = doc.DocumentElement; // System.Xml.XmlNode root = doc.FirstChild; //Display the contents of the child nodes. if (root.HasChildNodes) for (int iIndex = 0; iIndex < root.ChildNodes.Count; iIndex++) { System.Xml.XmlNode xmlNodeAuthor = root.ChildNodes[iIndex]; System.Xml.XmlElement xmlElementAuthorID = xmlNodeAuthor["TranslatorID"]; System.Xml.XmlElement xmlElementAuthorName = xmlNodeAuthor["TranslatorName"]; System.Web.UI.WebControls.HyperLink hlnkAuthor = new System.Web.UI.WebControls.HyperLink(); hlnkAuthor.Text = xmlElementAuthorName.InnerText; hlnkAuthor.NavigateUrl = "~/Author.aspx?pAuthorID=" + xmlElementAuthorID.InnerText; cellProp.Controls.Add(hlnkAuthor); cellProp.Controls.Add(new System.Web.UI.LiteralControl(" ")); } } cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblPublisher = new System.Web.UI.WebControls.Label(); lblPublisher.Text = "Publisher: " + dr["Publisher"].ToString(); cellProp.Controls.Add(lblPublisher); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblPublishedDate = new System.Web.UI.WebControls.Label(); lblPublishedDate.Text = "Published Date: " + dr["PublishedDate"].ToString(); cellProp.Controls.Add(lblPublishedDate); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblPrintingTimes = new System.Web.UI.WebControls.Label(); lblPrintingTimes.Text = "PrintingTimes: " + dr["PrintingTimes"].ToString(); cellProp.Controls.Add(lblPrintingTimes); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblPages = new System.Web.UI.WebControls.Label(); lblPages.Text = "Pages: " + dr["Pages"].ToString(); cellProp.Controls.Add(lblPages); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.Label lblDocumentSummary = new System.Web.UI.WebControls.Label(); lblDocumentSummary.Text = "DocumentSummary: " + dr["DocumentSummary"].ToString(); cellProp.Controls.Add(lblDocumentSummary); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); cellProp.Controls.Add(new System.Web.UI.LiteralControl("<br />")); System.Web.UI.WebControls.HyperLink hlnkDownload = new System.Web.UI.WebControls.HyperLink(); hlnkDownload.Text = "Download"; if (!(dr["DocumentID"] == null || dr.IsNull("DocumentID"))) { string strDownloadPath = System.String.Format("~/FileDownloadHandler.ashx?FileID={0}", dr["DocumentID"].ToString()); hlnkDownload.NavigateUrl = strDownloadPath; } cellProp.Controls.Add(hlnkDownload); */ tableRow = new System.Web.UI.WebControls.TableRow(); System.Web.UI.WebControls.TableCell tableCellDownloadHyperLink = new System.Web.UI.WebControls.TableCell(); System.Web.UI.WebControls.HyperLink hlnkDownload = new System.Web.UI.WebControls.HyperLink(); hlnkDownload.Text = "Download"; if (/*dataRow.FileID != null &&*/ !dataRow.IsFileIDNull()) { string strDownloadPath = System.String.Format("~/FileDownloadHandler.ashx?FileID={0}", dataRow.FileID.ToString()); hlnkDownload.NavigateUrl = strDownloadPath; } tableCellDownloadHyperLink.Controls.Add(hlnkDownload); tableRow.Cells.Add(tableCellDownloadHyperLink); table.Rows.Add(tableRow); } pnlDocumentDetail.Controls.Add(table); pnlDocumentDetail.Controls.Add(new System.Web.UI.LiteralControl("<br />")); }
public static void M(System.Web.HttpRequest request, System.Web.UI.WebControls.TextBox textBox) { Use(request); Use(textBox); }
public static void AddDefaultSubmit(System.Web.UI.WebControls.TextBox sourceObject, System.Web.UI.Control objectToSubmit, Boolean boolDropDownList = false) { sourceObject.Attributes.Add("onKeyPress", String.Format("javascript:{0}", ScriptDefaultSubmit(objectToSubmit, boolDropDownList))); }
public static void SetSNRangeValue(System.Web.UI.WebControls.TextBox txtStartSnQuery, System.Web.UI.WebControls.TextBox txtEndSnQuery) { //如果开始序号和结束序号都不为空,不操作,返回 if (txtStartSnQuery.Text.Trim() != string.Empty && txtEndSnQuery.Text.Trim() != string.Empty) { return; } //如果开始序号和结束序号都为空,不操作,返回 if (txtStartSnQuery.Text.Trim() == string.Empty && txtEndSnQuery.Text.Trim() == string.Empty) { return; } //如果其中一个不为空,而另一个为空,则开始序号和结束序号赋相同的值 if (txtStartSnQuery.Text.Trim() != string.Empty || txtEndSnQuery.Text.Trim() != string.Empty) { if (txtStartSnQuery.Text.Trim() != string.Empty) { txtEndSnQuery.Text = txtStartSnQuery.Text; } if (txtEndSnQuery.Text.Trim() != string.Empty) { txtStartSnQuery.Text = txtEndSnQuery.Text; } } }
public static void AddAtivarPesquisa(System.Web.UI.WebControls.TextBox sourceObject, String strTabela, String strDest = "", String strOrdExt = "", String strFiltroExt = "", String strReq = "", String eventName = "onClick", int idUsuarioValidaUnidade = 0) { sourceObject.Attributes.Add(eventName, String.Format("javascript:{0}; return false;", ScriptAtivaPesquisa(strTabela, strDest, strOrdExt, strFiltroExt, strReq))); }
public Movie(System.Web.UI.WebControls.TextBox movieID) : base() //un constructor vacio { }
public virtual void SogModalInit() { SogDiv SogModal = new SogDiv(); SogModal.CssClass = "SogModal"; SogModal.ID = "div_add"; Form.Controls.Add(SogModal); SogDiv modal_title = new SogDiv(); modal_title.CssClass = "modal_title"; modal_title.InnerText = "编辑"; SogModal.Controls.Add(modal_title); SogIcon ic = new SogIcon(); ic.CssClass = "fa fa-times-circle SogRight CoverClose"; ic.Attributes.Add("aria-hidden", "true"); modal_title.Controls.Add(ic); SogDiv modal_content = new SogDiv(); modal_content.CssClass = "modal_content"; SogModal.Controls.Add(modal_content); for (int i = 0; i < 100; i++) { SogDiv modal_item = new SogDiv(); modal_item.CssClass = "modal_item"; modal_content.Controls.Add(modal_item); SogSpan modal_item_title = new SogSpan(); modal_item_title.InnerText = "公司名字" + i.ToString(); modal_item_title.CssClass = "modal_item_title"; modal_item.Controls.Add(modal_item_title); SogDiv modal_item_content = new SogDiv(); modal_item_content.CssClass = "modal_item_content"; modal_item.Controls.Add(modal_item_content); System.Web.UI.WebControls.TextBox txt = new System.Web.UI.WebControls.TextBox(); txt.CssClass = "SogControl"; txt.Attributes.Add("placeholder", "公司名字" + i.ToString()); modal_item_content.Controls.Add(txt); } SogDiv modal_function = new SogDiv(); modal_function.CssClass = "modal_function"; SogModal.Controls.Add(modal_function); SogSpan btn_full = new SogSpan(); btn_full.CssClass = "btn_full"; btn_full.InnerText = "提交"; modal_function.Controls.Add(btn_full); SogSpan btn_empty = new SogSpan(); btn_empty.CssClass = "btn_empty CoverClose"; btn_empty.InnerText = "取消"; modal_function.Controls.Add(btn_empty); }
protected override void AttachChildControls() { this.calendarStartDate = (WebCalendar)this.FindControl("calendarStartDate"); this.calendarEndDate = (WebCalendar)this.FindControl("calendarEndDate"); this.hdorderId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdorderId"); this.txtOrderId = (System.Web.UI.WebControls.TextBox) this.FindControl("txtOrderId"); this.txtProductName = (System.Web.UI.WebControls.TextBox) this.FindControl("txtProductName"); this.txtShipId = (System.Web.UI.WebControls.TextBox) this.FindControl("txtShipId"); this.txtShipTo = (System.Web.UI.WebControls.TextBox) this.FindControl("txtShipTo"); this.txtCellPhone = (System.Web.UI.WebControls.TextBox) this.FindControl("txtCellPhone"); this.txtRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtRemark"); this.txtReturnRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReturnRemark"); this.txtReplaceRemark = (System.Web.UI.WebControls.TextBox) this.FindControl("txtReplaceRemark"); this.dropOrderStatus = (OrderStautsDropDownList)this.FindControl("dropOrderStatus"); this.dropPayType = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropPayType"); this.btnPay = ButtonManager.Create(this.FindControl("btnPay")); this.imgbtnSearch = (System.Web.UI.WebControls.ImageButton) this.FindControl("imgbtnSearch"); this.btnOk = ButtonManager.Create(this.FindControl("btnOk")); this.btnReturn = ButtonManager.Create(this.FindControl("btnReturn")); this.btnReplace = ButtonManager.Create(this.FindControl("btnReplace")); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.dropRefundType = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropRefundType"); this.dropRefundReason = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropRefundReason"); this.dropReturnReason = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropReturnReason"); this.dropReturnRefundType = (System.Web.UI.WebControls.DropDownList) this.FindControl("dropReturnRefundType"); this.listOrders = (Common_OrderManage_OrderList)this.FindControl("Common_OrderManage_OrderList"); this.pager = (Pager)this.FindControl("pager"); this.hlinkAllOrder = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkAllOrder"); this.hlinkNotPay = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkNotPay"); this.hlinkNotGetGoods = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkNotGetGoods"); this.hlinkFinished = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkFinished"); this.hlinkRefund = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkRefund"); this.hlinkReturn = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlinkReturn"); this.dropLogisticsCompany = (LogisticsCompanyDropDownList)this.FindControl("dropLogisticsCompany"); this.txtLogisticsId = (System.Web.UI.WebControls.TextBox) this.FindControl("txtLogisticsId"); this.quantityList = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("quantityList"); this.skuIds = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("skuIds"); this.LogisticsCompany = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("LogisticsCompany"); this.LogisticsId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("LogisticsId"); this.imgbtnSearch.Click += new System.Web.UI.ImageClickEventHandler(this.imgbtnSearch_Click); this.btnPay.Click += new System.EventHandler(this.btnPay_Click); this.btnOk.Click += new System.EventHandler(this.btnOk_Click); this.btnReturn.Click += new System.EventHandler(this.btnReturn_Click); this.btnReplace.Click += new System.EventHandler(this.btnReplace_Click); this.listOrders.ItemDataBound += new Common_OrderManage_OrderList.DataBindEventHandler(this.listOrders_ItemDataBound); this.listOrders.ItemCommand += new Common_OrderManage_OrderList.CommandEventHandler(this.listOrders_ItemCommand); //this.rptOrderProducts = (VshopTemplatedRepeater)this.FindControl("rptOrderProducts"); //物流选择绑定值 //IList<string> list = ExpressHelper.GetAllExpressName(); //List<ListItem> item = new List<ListItem>(); //foreach (string s in list) //{ // item.Add(new ListItem(s, s)); //} //dropLogisticsCompany.Items.AddRange(item.ToArray()); PageTitle.AddSiteNameTitle("我的订单"); if (!this.Page.IsPostBack) { this.OrderRefundTime = string.IsNullOrEmpty(System.Configuration.ConfigurationManager.AppSettings["OrderRefunTime"]) ? 30 : int.Parse(System.Configuration.ConfigurationManager.AppSettings["OrderRefunTime"].ToString()); this.SetOrderStatusLink(); this.dropPayType.DataSource = TradeHelper.GetPaymentModes(PayApplicationType.payOnPC); this.dropPayType.DataTextField = "Name"; this.dropPayType.DataValueField = "ModeId"; this.dropPayType.DataBind(); this.BindOrders(); dropLogisticsCompany.DataBind(); BindRefundReason(); BindReturnReason(); } //this.rptOrderProducts.DataSource = ShoppingProcessor.GetOrderItems(orderId); //this.rptOrderProducts.DataBind(); }
public static void HtmlForm(System.Web.UI.HtmlControls.HtmlControl htmlControl, string[] fields, int[] widths, int[] lengths, string functionSubmit = null, string[] types = null) { System.Web.UI.WebControls.Panel panel; System.Web.UI.WebControls.Label label; System.Web.UI.WebControls.TextBox textBox; System.Web.UI.WebControls.Button button; functionSubmit = functionSubmit ?? "void(0)"; if (types == null) { types = new string[fields.Length]; for (int i = 0; i < fields.Length; i++) { types[i] = "t"; } } for (int i = 0; i < fields.Length; i++) { label = new System.Web.UI.WebControls.Label { ID = "label_" + i, Text = fields[i], CssClass = "label" }; textBox = new System.Web.UI.WebControls.TextBox { ID = ("field_" + fields[i]).Replace(" ", "_").ToLower(), MaxLength = lengths[i], CssClass = "input border", TextMode = types[i].Equals("pwd") ? System.Web.UI.WebControls.TextBoxMode.Password : System.Web.UI.WebControls.TextBoxMode.SingleLine }; panel = new System.Web.UI.WebControls.Panel { ID = "panel_" + i, CssClass = "col padding-16 s12 m" + widths[i] }; panel.Controls.Add(label); panel.Controls.Add(textBox); htmlControl.Controls.Add(panel); } panel = new System.Web.UI.WebControls.Panel { ID = "panel_submit", CssClass = "col padding-16 s12" }; button = new System.Web.UI.WebControls.Button { ID = "submit_form", CssClass = "button blue hover-blue-gray", Text = "Enviar dados", OnClientClick = functionSubmit }; panel.Controls.Add(button); htmlControl.Controls.Add(panel); }
public static void PrintOut(System.Web.UI.WebControls.TextBox box, string msg) { box.Text = msg; }
internal void enviaSenha(string p, string p_2, System.Web.UI.WebControls.TextBox txtEmail, int p_3) { throw new NotImplementedException(); }
public bool htmlInjectionValida(String _informacion, ref String _mensaje, String _etiquetaReferente, ref System.Web.UI.WebControls.TextBox _control) { bool isMatch = this.htmlInjectionRegex.IsMatch(_informacion); if (isMatch) { _mensaje = "Caracteres no permitidos en " + _etiquetaReferente.Replace(":", ""); _control.Focus(); } return isMatch; }
private void GenTextBoxTemplate(String ExtraName) { if (ExtraName == "") { System.Web.UI.WebControls.Label aLabel = new System.Web.UI.WebControls.Label(); aLabel.ID = "l" + FTableName + FFieldItem.DataField + ExtraName + "GridView"; aLabel.ToolTip = FFieldItem.DataField; FContainer.Controls.Add(aLabel); Boolean Found = false; foreach (System.Web.UI.WebControls.Label bLabel in aLabelList) { if (String.Compare(aLabel.ID, bLabel.ID) == 0) { Found = true; break; } } if (!Found) { aLabelList.Add(aLabel); } } else { System.Web.UI.WebControls.TextBox aTextBox = new System.Web.UI.WebControls.TextBox(); aTextBox.ID = "wdtp" + FTableName + FFieldItem.DataField + ExtraName + "GridView"; aTextBox.ToolTip = FFieldItem.DataField; //aPicker.Text = String.Format("'<%# Bind(\"{0}\") %>'", FFieldItem.DataField); FContainer.Controls.Add(aTextBox); Boolean Found = false; foreach (System.Web.UI.WebControls.TextBox bWebPicker in aWebTextBoxList) { if (String.Compare(aTextBox.ID, bWebPicker.ID) == 0) { Found = true; break; } } if (!Found) { aWebTextBoxList.Add(aTextBox); //Add AddNewRowControlItem to WebGridView if (ExtraName == "F") { if (FWebGridView != null) { Found = false; foreach (AddNewRowControlItem aControlItem in FWebGridView.AddNewRowControls) { if (aControlItem.FieldName.CompareTo(FFieldItem.DataField) == 0) { Found = true; break; } } if (!Found) { AddNewRowControlItem aItem = new AddNewRowControlItem(); aItem.ControlID = "wdtp" + FTableName + FFieldItem.DataField + ExtraName; aItem.ControlType = WebGridView.AddNewRowControlType.TextBox; aItem.FieldName = FFieldItem.DataField; FWebGridView.AddNewRowControls.Add(aItem); } } } } } }
/// <summary> /// 清理表单 /// </summary> /// <param name="control"></param> public static void ClearForm(WebUI.Control control) { if (control == null) { return; } foreach (WebUI.Control ctl in control.Controls) { Type type = ctl.GetType(); #region 处理服务器控件 if (type == typeof(WebUI.WebControls.TextBox))//文本框 { WebUI.WebControls.TextBox box = ((WebUI.WebControls.TextBox)ctl); box.Text = ""; if (box.Attributes["isNumber"] != null) { box.Text = "0"; } } else if (type == typeof(WebUI.WebControls.DropDownList))//选择框 { ((WebUI.WebControls.DropDownList)ctl).SelectedIndex = -1; } else if (type == typeof(WebUI.WebControls.HiddenField))//隐藏域 { ((WebUI.WebControls.HiddenField)ctl).Value = ""; } else if (type == typeof(WebUI.WebControls.RadioButton))//单选框 { WebUI.WebControls.RadioButton rb = (WebUI.WebControls.RadioButton)ctl; rb.Checked = false; } else if (type == typeof(WebUI.WebControls.CheckBox))//复选框 { WebUI.WebControls.CheckBox ck = (WebUI.WebControls.CheckBox)ctl; ck.Checked = false; } else if (type == typeof(WebUI.WebControls.CheckBoxList))//复选框列表 { WebUI.WebControls.CheckBoxList ck = (WebUI.WebControls.CheckBoxList)ctl; foreach (WebUI.WebControls.ListItem li in ck.Items) { li.Selected = false; } } else if (type == typeof(WebUI.WebControls.RadioButtonList))//单框列表 { WebUI.WebControls.RadioButtonList ck = (WebUI.WebControls.RadioButtonList)ctl; foreach (WebUI.WebControls.ListItem li in ck.Items) { li.Selected = false; } } else if (type == typeof(WebUI.WebControls.ListBox))//列表框 { WebUI.WebControls.ListBox ck = (WebUI.WebControls.ListBox)ctl; foreach (WebUI.WebControls.ListItem li in ck.Items) { li.Selected = false; } } #endregion #region 处理不同Html控件 else if (type == typeof(WebUI.HtmlControls.HtmlInputText))//文本域 { WebUI.HtmlControls.HtmlInputText ct = (WebUI.HtmlControls.HtmlInputText)ctl; ct.Value = ""; if (ct.Attributes["isNumber"] != null) { ct.Value = "0"; } } else if (type == typeof(WebUI.HtmlControls.HtmlTextArea))//文本域 { WebUI.HtmlControls.HtmlTextArea ct = (WebUI.HtmlControls.HtmlTextArea)ctl; ct.Value = ""; } else if (type == typeof(WebUI.HtmlControls.HtmlSelect))//选择域 { WebUI.HtmlControls.HtmlSelect ct = (WebUI.HtmlControls.HtmlSelect)ctl; ct.SelectedIndex = -1; } else if (type == typeof(WebUI.HtmlControls.HtmlInputHidden))////隐藏域 { WebUI.HtmlControls.HtmlInputHidden ct = (WebUI.HtmlControls.HtmlInputHidden)ctl; ct.Value = ""; if (ct.Attributes["isNumber"] != null) { ct.Value = "0"; } } else if (type == typeof(WebUI.HtmlControls.HtmlInputRadioButton))//单选域 { WebUI.HtmlControls.HtmlInputRadioButton rb = (WebUI.HtmlControls.HtmlInputRadioButton)ctl; rb.Checked = false; } else if (type == typeof(WebUI.HtmlControls.HtmlInputCheckBox))//复选域 { WebUI.HtmlControls.HtmlInputCheckBox ck = (WebUI.HtmlControls.HtmlInputCheckBox)ctl; ck.Checked = false; } else if (type == typeof(WebUI.HtmlControls.HtmlInputPassword))//密码域 { WebUI.HtmlControls.HtmlInputPassword ck = (WebUI.HtmlControls.HtmlInputPassword)ctl; ck.Value = ""; } #endregion } }
protected override bool ControlPropertiesValid() { // Should have a text box control to check Control ctrl = FindControl(ControlToValidate); if ( null != ctrl ) { if (ctrl is System.Web.UI.WebControls.TextBox) // ensure its a text box { _creditCardTextBox = (System.Web.UI.WebControls.TextBox) ctrl; // set the member variable return ( null != _creditCardTextBox ); // check that it's been set ok } else return false; } else return false; }
/// <summary> /// Creates the controls. /// </summary> private void CreateControls() { var items = 0; int.TryParse(tbComprobantes.Text, out items); panelComprobantes.Controls.Clear(); for (var i = 1; i <= items; i++) { if (!((Dictionary <int, object[]>)Session["_files"]).ContainsKey(i)) { ((Dictionary <int, object[]>)Session["_files"]).Add(i, new object[] { null, null, null, null }); } #region Definicion de Panel var content = new HtmlGenericControl("div"); content.ID = "panelComprobante" + i; content.Attributes["class"] = "panel panel-primary"; content.Style["background-color"] = "rgba(245, 245, 245, 0)"; var heading = new HtmlGenericControl("div"); SqlDataSourceTipoProveedor.ConnectionString = _dbr.CadenaConexion; var ddlTipoProveedor = new System.Web.UI.WebControls.DropDownList { CssClass = "form-control", DataSourceID = "SqlDataSourceTipoProveedor", DataValueField = "IdTipo", DataTextField = "nombre", ID = "ddlTipoProveedor" + i }; ddlTipoProveedor.Attributes.Add("style", "text-align:center;display:" + (Convert.ToBoolean(Session["_isWorkflow"]) ? "inline" : "none")); ddlTipoProveedor.ClientIDMode = ClientIDMode.Static; ddlTipoProveedor.Visible = false; //ddlTipoProveedor.Visible = Convert.ToBoolean(Session["_isWorkflow"]); var tbObservaciones = new System.Web.UI.WebControls.TextBox { CssClass = "form-control", ID = "tbObservaciones" + i }; tbObservaciones.Attributes.Add("style", "text-align:center;"); tbObservaciones.Attributes.Add("placeholder", "OBSERVACIONES OPCIONALES PARA EL COMPROBANTE " + i); tbObservaciones.ClientIDMode = ClientIDMode.Static; heading.Attributes["class"] = "panel panel-heading"; var innerRow1 = new HtmlGenericControl("div"); innerRow1.Attributes["class"] = "row panel-title"; var innerCol1 = new HtmlGenericControl("div"); innerCol1.Attributes["class"] = "col-md-6"; innerCol1.Attributes["style"] = "text-align: left;"; var innerCol2 = new HtmlGenericControl("div"); innerCol2.Attributes["class"] = "col-md-2"; var innerCol3 = new HtmlGenericControl("div"); innerCol3.Attributes["class"] = "col-md-4"; var h3 = new System.Web.UI.HtmlControls.HtmlGenericControl("span"); h3.InnerText = "Comprobante " + i + ""; var span3 = new System.Web.UI.HtmlControls.HtmlGenericControl("span"); span3.InnerText = Convert.ToBoolean(Session["_isWorkflow"]) ? "Tipo de Proveedor: " : ""; span3.Visible = false; var innerRow2 = new HtmlGenericControl("div"); innerRow2.Attributes["class"] = "row"; var innerCol1_2 = new HtmlGenericControl("div"); innerCol1_2.Attributes["class"] = "col-md-12"; innerCol1_2.Attributes["style"] = "text-align: center;"; innerCol1_2.Controls.Add(tbObservaciones); innerCol1.Controls.Add(h3); innerCol2.Controls.Add(span3); innerCol2.Visible = Session["IDENTEMI"].ToString().Equals("HIM890120VEA") || Session["IDENTEMI"].ToString().Equals("SIH071204N90") || Session["IDENTEMI"].ToString().Equals("LAN7008173R5"); innerCol3.Controls.Add(ddlTipoProveedor); innerCol3.Visible = Session["IDENTEMI"].ToString().Equals("HIM890120VEA") || Session["IDENTEMI"].ToString().Equals("SIH071204N90") || Session["IDENTEMI"].ToString().Equals("LAN7008173R5"); innerRow1.Controls.Add(innerCol1); innerRow1.Controls.Add(innerCol2); innerRow1.Controls.Add(innerCol3); innerRow2.Controls.Add(innerCol1_2); heading.Controls.Add(innerRow1); heading.Controls.Add(innerRow2); var body = new HtmlGenericControl("div"); body.Attributes["class"] = "panel-body"; #endregion #region Division de rows var rowFilesFixed = new HtmlGenericControl("div"); rowFilesFixed.ID = "rowFixed" + i; rowFilesFixed.Attributes["class"] = "row"; var emptyRow = new HtmlGenericControl("div"); emptyRow.Attributes["class"] = "row"; emptyRow.InnerHtml = " "; var rowDropZone = new HtmlGenericControl("div"); rowDropZone.ID = "rowDropZone" + i; rowDropZone.Attributes["class"] = "row"; var colFilesFixed = new HtmlGenericControl("div"); colFilesFixed.ID = "colFixed" + i; colFilesFixed.Attributes["class"] = "col-md-12"; var colDropzone = new HtmlGenericControl("div"); colDropzone.ID = "colDropzone" + i; colDropzone.Attributes["class"] = "col-md-12"; var collapseDropZone = new HtmlGenericControl("div"); collapseDropZone.ID = "collapseDropZone" + i; collapseDropZone.Attributes["class"] = "collapse"; collapseDropZone.ClientIDMode = ClientIDMode.Static; var rowBtnCollapse = new HtmlGenericControl("div"); rowBtnCollapse.ID = "rowBtnCollapse" + i; rowBtnCollapse.InnerHtml = "<button id='bCollapseAdicionales' runat='server' class='btn btn-primary btn-xs' type='button' data-toggle='collapse' data-target='#" + collapseDropZone.ClientID + "' aria-expanded='false' aria-controls='" + collapseDropZone.ClientID + "' visible='false'><span class='glyphicon glyphicon-plus-sign' aria-hidden='true'></span> Archivos Adicionales</button>"; #endregion #region Titulos var rowTitulos = new HtmlGenericControl("div"); rowTitulos.ID = "rowTitulo" + i; rowTitulos.Attributes["class"] = "row"; var colTitulo1 = new HtmlGenericControl("div"); colTitulo1.ID = "colTitulo" + i + "_1"; colTitulo1.Attributes["class"] = "col-md-4"; colTitulo1.InnerHtml = "ARCHIVO XML *:"; var colTitulo2 = new HtmlGenericControl("div"); colTitulo2.ID = "colTitulo" + i + "_2"; colTitulo2.Attributes["class"] = "col-md-4"; colTitulo2.InnerHtml = "ARCHIVO PDF *:"; var colTitulo3 = new HtmlGenericControl("div"); colTitulo3.ID = "colTitulo" + i + "_3"; colTitulo3.Attributes["class"] = "col-md-4"; colTitulo3.InnerHtml = "ORDEN DE COMPRA (OPCIONAL):"; #endregion #region Columnas var rowFields = new HtmlGenericControl("div"); rowFields.ID = "rowComprobante" + i; rowFields.Attributes["class"] = "row"; var colXml = new HtmlGenericControl("div"); colXml.ID = "colXML" + i; colXml.Attributes["class"] = "col-md-4"; var colPdf = new HtmlGenericControl("div"); colPdf.ID = "colPDF" + i; colPdf.Attributes["class"] = "col-md-4"; var colOrden = new HtmlGenericControl("div"); colOrden.ID = "colOrden" + i; colOrden.Attributes["class"] = "col-md-4"; #endregion #region Componentes var xml = new AsyncFileUpload(); xml.ID = "xml_" + i; xml.Style["text-align"] = "center"; xml.UploadedComplete += AsyncFileUpload_UploadedComplete; xml.OnClientUploadStarted = "xmlUpload"; xml.OnClientUploadError = "UploadError"; var pdf = new AsyncFileUpload(); pdf.ID = "pdf_" + i; pdf.Style["text-align"] = "center"; pdf.UploadedComplete += AsyncFileUpload_UploadedComplete; pdf.OnClientUploadStarted = "pdfUpload"; pdf.OnClientUploadError = "UploadError"; var orden = new AsyncFileUpload(); orden.ID = "orden_" + i; orden.Style["text-align"] = "center"; orden.UploadedComplete += AsyncFileUpload_UploadedComplete; orden.OnClientUploadStarted = "ordenUpload"; orden.OnClientUploadError = "UploadError"; var adicionales = new HtmlGenericControl("div"); adicionales.ID = "adicionales_" + i; adicionales.Attributes["class"] = "dropzone"; adicionales.Attributes["maxFiles"] = "10"; adicionales.Attributes["maxFileSizeMb"] = "10"; adicionales.Attributes["extraParam"] = i.ToString(); adicionales.Attributes["idBlockedButton"] = lbSubir.ClientID; adicionales.Attributes["message"] = "<button type='button' class='btn btn-primary' data-toggle='tooltip' data-placement='bottom' title='Haga click o arrastre/suelte aquí para agregar archivos adicionales'><i class='fa fa-plus-square-o' aria-hidden='true'></i> Agregar</button>"; var url = ResolveClientUrl("~/recepcion/DropzoneHandler.ashx"); var urlAjax = ResolveClientUrl("~/recepcion/SubirArchivos.aspx") + "/DropZone_UploadedComplete"; adicionales.Attributes["url"] = url; adicionales.Attributes["urlAjax"] = urlAjax; #endregion #region Creacion de layout rowTitulos.Controls.Add(colTitulo1); rowTitulos.Controls.Add(colTitulo2); rowTitulos.Controls.Add(colTitulo3); colXml.Controls.Add(xml); colPdf.Controls.Add(pdf); colOrden.Controls.Add(orden); rowFields.Controls.Add(colXml); rowFields.Controls.Add(colPdf); rowFields.Controls.Add(colOrden); colFilesFixed.Controls.Add(rowTitulos); colFilesFixed.Controls.Add(rowFields); collapseDropZone.Controls.Add(adicionales); colDropzone.Controls.Add(rowBtnCollapse); colDropzone.Controls.Add(collapseDropZone); rowFilesFixed.Controls.Add(colFilesFixed); rowDropZone.Controls.Add(colDropzone); body.Controls.Add(rowFilesFixed); body.Controls.Add(emptyRow); body.Controls.Add(rowDropZone); content.Controls.Add(heading); content.Controls.Add(body); panelComprobantes.Controls.Add(content); #endregion } lbSubir.Visible = (items > 0); }