當前位置: 首頁>>代碼示例>>C#>>正文


C# HtmlControls.HtmlInputText類代碼示例

本文整理匯總了C#中System.Web.UI.HtmlControls.HtmlInputText的典型用法代碼示例。如果您正苦於以下問題:C# HtmlInputText類的具體用法?C# HtmlInputText怎麽用?C# HtmlInputText使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


HtmlInputText類屬於System.Web.UI.HtmlControls命名空間,在下文中一共展示了HtmlInputText類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HoneyPotField

        /// <summary>
        /// Renders out field with honeypot security check enabled
        /// </summary>
        /// <param name="helper">HtmlHelper which will be extended</param>
        /// <param name="name">Name of field. Should match model field of string type</param>
        /// <param name="value">Value of the field</param>
        /// <param name="css">CSS class to be applied to input field</param>
        /// <returns>Returns render out MvcHtmlString for displaying on the View</returns>
        public static MvcHtmlString HoneyPotField(this HtmlHelper helper, string name, object value, string inputCss = null, InputType fieldType=InputType.Text,string honeypotCss = null, InputType honeypotType=InputType.Hidden)
        {
            StringBuilder sbControlHtml = new StringBuilder();
            using (StringWriter stringWriter = new StringWriter())
            {
                using (HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter))
                {
                    HtmlInputText hashedField = new HtmlInputText(fieldType.ToString().ToLower());
                    string hashedName = GetHashedPropertyName(name);
                    hashedField.Value = value != null ? value.ToString() : string.Empty;
                    hashedField.ID = hashedName;
                    hashedField.Name = hashedName;
                    if (!string.IsNullOrWhiteSpace(inputCss))
                    {
                        hashedField.Attributes["class"] = inputCss;
                    }
                    hashedField.RenderControl(htmlWriter);


                    HtmlInputText hiddenField = new HtmlInputText(honeypotType.ToString().ToLower());
                    hiddenField.Value = string.Empty;
                    hiddenField.ID = name;
                    hiddenField.Name = name;
                    if (!string.IsNullOrWhiteSpace(honeypotCss))
                    {
                        hiddenField.Attributes["class"] = honeypotCss;
                    }
                    hiddenField.RenderControl(htmlWriter);
                    sbControlHtml.Append(stringWriter.ToString());
                }
            }
            return new MvcHtmlString(sbControlHtml.ToString());
        }
開發者ID:dejanstojanovic,項目名稱:MVC-Honeypot,代碼行數:41,代碼來源:HtmlHelpers.cs

示例2: AttachChildControls

 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId))
     {
         base.GotoResourceNotFound();
     }
     this.txtEmail = (TextBox) this.FindControl("txtEmail");
     this.txtUserName = (TextBox) this.FindControl("txtUserName");
     this.txtContent = (TextBox) this.FindControl("txtContent");
     this.btnRefer = ButtonManager.Create(this.FindControl("btnRefer"));
     this.txtConsultationCode = (HtmlInputText) this.FindControl("txtConsultationCode");
     this.prodetailsLink = (ProductDetailsLink) this.FindControl("ProductDetailsLink1");
     this.btnRefer.Click += new EventHandler(this.btnRefer_Click);
     if (!this.Page.IsPostBack)
     {
         PageTitle.AddSiteNameTitle("商品谘詢", HiContext.Current.Context);
         if ((HiContext.Current.User.UserRole == UserRole.Member) || (HiContext.Current.User.UserRole == UserRole.Underling))
         {
             this.txtUserName.Text = HiContext.Current.User.Username;
             this.txtEmail.Text = HiContext.Current.User.Email;
             this.btnRefer.Text = "谘詢";
         }
         ProductInfo productSimpleInfo = ProductBrowser.GetProductSimpleInfo(this.productId);
         if (productSimpleInfo != null)
         {
             this.prodetailsLink.ProductId = this.productId;
             this.prodetailsLink.ProductName = productSimpleInfo.ProductName;
         }
         this.txtConsultationCode.Value = string.Empty;
     }
 }
開發者ID:davinx,項目名稱:himedi,代碼行數:31,代碼來源:ProductConsultations.cs

示例3: CreateChildControls

        protected override void CreateChildControls()
        {
            //cellSpacing="1" cellPadding="1" width="300" border="0"
            fileTable.CellPadding = 1;
            fileTable.CellSpacing = 1;
            fileTable.BorderStyle = BorderStyle.None;
            fileTable.Width = 300;
            fileTable.Attributes.Add("align","center");

            srcTextBox.ID="FilePicker1";
            srcTextBox.Enabled = false;
            srcTextBox.fpAllowedUploadFileExts = "gif,jpg,jpeg,png";
            srcTextBox.fpUploadDir="/Uploads";
            srcTextBox.fpPopupURL = "FilePicker.aspx";
            srcTextBox.fpImageURL= "/images/browse.gif";
            srcTextBox.fpAllowCreateDirs = false;
            srcTextBox.fpAllowDelete = false;

            fileMgrCell.Controls.Add(new LiteralControl("Image Source: "));
            fileMgrCell.Attributes.Add("colSpan","4");
            fileMgrCell.Controls.Add(srcTextBox);
            fileMgrRow.Cells.Add(fileMgrCell);
            fileTable.Rows.Add(fileMgrRow);

            altTextCell.Controls.Add(new LiteralControl("Alternate Text:"));
            HtmlInputText altText = new HtmlInputText();
            altText.ID="AltText";
            altTextCell.Wrap = false;
            altTextCell.Attributes.Add("colSpan","4");
            altTextCell.Controls.Add(altText);
            altTextRow.Cells.Add(altTextCell);
            fileTable.Rows.Add(altTextRow);

            HtmlSelect selAlign = new HtmlSelect();
            selAlign.Items.Add("Select");
            selAlign.Items.Add("Left");
            selAlign.Items.Add("Middle");
            selAlign.Items.Add("Right");
            selAlign.Items.Add("Absbottom");
            selAlign.Items.Add("Absmiddle");
            selAlign.Items.Add("Baseline");

            HtmlInputText borderSize = new HtmlInputText();
            borderSize.Size = 1;
            borderSize.ID="border";

            cell1Row1.Controls.Add(new LiteralControl("Alignment:"));
            cell2Row1.Controls.Add(selAlign);
            cell3Row1.Controls.Add(new LiteralControl("Border Size:"));
            cell4Row1.Controls.Add(borderSize);

            propRow1.Cells.Add(cell1Row1);
            propRow1.Cells.Add(cell2Row1);
            propRow1.Cells.Add(cell3Row1);
            propRow1.Cells.Add(cell4Row1);

            fileTable.Rows.Add(propRow1);
            Controls.Add(fileTable);
        }
開發者ID:dineshkummarc,項目名稱:DotNetPortalSrc-102,代碼行數:59,代碼來源:ImageManager.cs

示例4: AddBookInputText

        private void AddBookInputText(HtmlGenericControl container)
        {
            using (HtmlGenericControl field = HtmlControlHelper.GetField())
            {
                this.bookInputText = new HtmlInputText();
                this.bookInputText.Attributes.Add("placeholder", Titles.Book);

                field.Controls.Add(this.bookInputText);
                container.Controls.Add(field);
            }
        }
開發者ID:njmube,項目名稱:mixerp,代碼行數:11,代碼來源:TopPanel.cs

示例5: AttachChildControls

 protected override void AttachChildControls()
 {
     int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
     this.keyWord = this.Page.Request.QueryString["keyWord"];
     if (!string.IsNullOrWhiteSpace(this.keyWord))
     {
         this.keyWord = this.keyWord.Trim();
     }
     this.txtkeywords = (HtmlInputText) this.FindControl("keywords");
     this.rpChooseProducts = (VshopTemplatedRepeater) this.FindControl("rpChooseProducts");
     this.rpCategorys = (VshopTemplatedRepeater) this.FindControl("rpCategorys");
     this.DataBindSoruce();
 }
開發者ID:ZhangVic,項目名稱:asp1110git,代碼行數:13,代碼來源:VMyProducts.cs

示例6: AddItemCodeInputText

        private void AddItemCodeInputText(TableRow row)
        {
            using (TableCell cell = this.GetCell())
            {
                using (HtmlInputText itemCodeInputText = new HtmlInputText())
                {
                    itemCodeInputText.ID = "ItemCodeInputText";

                    cell.Controls.Add(itemCodeInputText);
                }

                row.Controls.Add(cell);
            }
        }
開發者ID:abinabrahamanchery,項目名稱:mixerp,代碼行數:14,代碼來源:GridInlineForm.cs

示例7: AddQuantityInputText

        private void AddQuantityInputText(TableRow row)
        {
            using (TableCell cell = this.GetCell())
            {
                using (HtmlInputText quantityInputText = new HtmlInputText())
                {
                    quantityInputText.ID = "QuantityInputText";
                    quantityInputText.Attributes.Add("class", "text-right integer");
                    cell.Controls.Add(quantityInputText);
                }

                row.Controls.Add(cell);
            }
        }
開發者ID:abinabrahamanchery,項目名稱:mixerp,代碼行數:14,代碼來源:GridInlineForm.cs

示例8: CreateItemCodeField

        private static void CreateItemCodeField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText itemCodeInputText = new HtmlInputText())
                {
                    itemCodeInputText.ID = "ItemCodeInputText";
                    itemCodeInputText.Attributes.Add("title", "ALT + C");

                    cell.Controls.Add(itemCodeInputText);
                }

                row.Cells.Add(cell);
            }
        }
開發者ID:JonathanValle,項目名稱:mixerp,代碼行數:15,代碼來源:Item.cs

示例9: CreateCommentCell

        private void CreateCommentCell(TableRow row, int index)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText commentTextBox = new HtmlInputText())
                {
                    commentTextBox.ID = "CommentTextBox" + index;
                    commentTextBox.Attributes.Add("class", "comment");

                    cell.Controls.Add(commentTextBox);
                }

                row.Controls.Add(cell);
            }
        }
開發者ID:abinabrahamanchery,項目名稱:mixerp,代碼行數:15,代碼來源:Row.cs

示例10: CreateSubTotalField

        private static void CreateSubTotalField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText subTotalInputText = new HtmlInputText())
                {
                    subTotalInputText.ID = "SubTotalInputText";
                    subTotalInputText.Attributes.Add("class", "currency text-right");
                    subTotalInputText.Attributes.Add("readonly", "readonly");

                    cell.Controls.Add(subTotalInputText);
                }

                row.Cells.Add(cell);
            }
        }
開發者ID:njmube,項目名稱:mixerp,代碼行數:16,代碼來源:SubTotal.cs

示例11: AttachChildControls

 protected override void AttachChildControls()
 {
     PageTitle.AddSiteNameTitle("申請提現");
     this.litMaxMoney = (Literal) this.FindControl("litMaxMoney");
     this.txtaccount = (HtmlInputText) this.FindControl("txtaccount");
     this.txtmoney = (HtmlInputText) this.FindControl("txtmoney");
     DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId());
     this.txtaccount.Value = userIdDistributors.RequestAccount;
     this.litMaxMoney.Text = userIdDistributors.ReferralBlance.ToString("F2");
     decimal result = 0M;
     if (decimal.TryParse(SettingsManager.GetMasterSettings(false).MentionNowMoney, out result) && (result > 0M))
     {
         this.litMaxMoney.Text = ((userIdDistributors.ReferralBlance / result) * result).ToString("F2");
         this.txtmoney.Attributes["placeholder"] = "請輸入" + result + "的倍數金額";
     }
 }
開發者ID:ZhangVic,項目名稱:asp1110git,代碼行數:16,代碼來源:VRequestCommissions.cs

示例12: CreatePriceField

        private static void CreatePriceField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText priceInputText = new HtmlInputText())
                {
                    priceInputText.ID = "PriceInputText";
                    priceInputText.Attributes.Add("title", "Alt + P");
                    priceInputText.Attributes.Add("class", "currency text-right");

                    cell.Controls.Add(priceInputText);
                }

                row.Cells.Add(cell);
            }
        }
開發者ID:abinabrahamanchery,項目名稱:mixerp,代碼行數:16,代碼來源:PriceType.cs

示例13: CreateTaxtField

        private static void CreateTaxtField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText taxInputText = new HtmlInputText())
                {
                    taxInputText.ID = "TaxInputText";
                    taxInputText.Attributes.Add("class", "currency text-right");
                    taxInputText.Attributes.Add("readonly", "readonly");

                    cell.Controls.Add(taxInputText);
                }

                row.Cells.Add(cell);
            }
        }
開發者ID:JonathanValle,項目名稱:mixerp,代碼行數:16,代碼來源:Tax.cs

示例14: CreateDiscountField

        private static void CreateDiscountField(TableRow row)
        {
            using (TableCell cell = new TableCell())
            {
                using (HtmlInputText discountInputText = new HtmlInputText())
                {
                    discountInputText.ID = "DiscountInputText";
                    discountInputText.Attributes.Add("title", "Ctrl + D");
                    discountInputText.Attributes.Add("class", "currency text-right");

                    cell.Controls.Add(discountInputText);
                }

                row.Cells.Add(cell);
            }
        }
開發者ID:JonathanValle,項目名稱:mixerp,代碼行數:16,代碼來源:Discount.cs

示例15: GetInputText

        public static HtmlInputText GetInputText(string id, string cssClass)
        {
            using (HtmlInputText input = new HtmlInputText())
            {
                if (!string.IsNullOrWhiteSpace(id))
                {
                    input.ID = id;
                }

                if (!string.IsNullOrWhiteSpace(cssClass))
                {
                    input.Attributes.Add("class", cssClass);
                }

                return input;
            }
        }
開發者ID:abinabrahamanchery,項目名稱:mixerp,代碼行數:17,代碼來源:ControlHelper.cs


注:本文中的System.Web.UI.HtmlControls.HtmlInputText類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。