本文整理汇总了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());
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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 + "的倍数金额";
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}