本文整理汇总了C#中System.Web.UI.WebControls.TextBox类的典型用法代码示例。如果您正苦于以下问题:C# TextBox类的具体用法?C# TextBox怎么用?C# TextBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextBox类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TextBox类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateChildControls
protected override void CreateChildControls()
{
base.CreateChildControls();
Label lbl = new Label();
TextBox txt = new TextBox();
Button btn = new Button();
DateTime dt = DateTime.Now;
btn.Text = "Show All Lists";
btn.Click += delegate
{
do
{
SPWebCollection Webs;
SPListCollection lists;
Webs = SPContext.Current.Site.AllWebs;
foreach (SPWeb web in Webs)
{
lists = web.Lists;
foreach (SPList list in lists)
lbl.Text = lbl.Text + "<br>" + list.Title;
}
}
while (dt.AddSeconds(int.Parse(txt.Text)).CompareTo(DateTime.Now) > 0);
};
Controls.Add(txt);
Controls.Add(btn);
Controls.Add(lbl);
}
开发者ID:sreekanth642,项目名称:sp2010_lab,代码行数:31,代码来源:SBWebPart.cs
示例2: EditString_Init
void EditString_Init(object sender, EventArgs e)
{
if (IsNotAListOfValues)
{
var ctlTextBox = new TextBox {TextMode = TextBoxMode.SingleLine, Rows = 1};
CtlValueBox = ctlTextBox;
if (ValidationRule != "")
{
StrValRule = ValidationRule;
StrValMsg = ValidationMessage;
}
}
else
{
var ctlListControl = GetListControl();
AddListItems(ctlListControl);
CtlValueBox = ctlListControl;
}
Value = DefaultValue;
if (Required) CtlValueBox.CssClass = "dnnFormRequired";
if (!String.IsNullOrEmpty( Style)) CtlValueBox.Style.Value = Style;
CtlValueBox.ID = CleanID(FieldTitle);
ValueControl = CtlValueBox;
Controls.Add(CtlValueBox);
}
开发者ID:DNNCommunity,项目名称:DNN.FormAndList,代码行数:25,代码来源:String.cs
示例3: AgregarControles
protected void AgregarControles(Label nombreContr, CheckBox chB, TextBox tbox, HiddenField nuevoHidF, Label hrReg, Label observ)
{
try
{
PanelConVisita.Controls.Add(new LiteralControl("<tr>"));
PanelConVisita.Controls.Add(new LiteralControl("<td>"));
PanelConVisita.Controls.Add(nombreContr);
PanelConVisita.Controls.Add(new LiteralControl("</td><td>"));
PanelConVisita.Controls.Add(new LiteralControl(" "));
PanelConVisita.Controls.Add(new LiteralControl("</td><td>"));
if (hrReg == null)
{
PanelConVisita.Controls.Add(chB);
}
else
{
PanelConVisita.Controls.Add(hrReg);
}
PanelConVisita.Controls.Add(new LiteralControl("</td><td>"));
if (hrReg == null)
{
PanelConVisita.Controls.Add(tbox);
}
else
{
PanelConVisita.Controls.Add(observ);
}
PanelConVisita.Controls.Add(new LiteralControl("</td></tr>"));
}
catch (Exception ex)
{
return;
}
}
开发者ID:xtiansol,项目名称:MORRABCV,代码行数:35,代码来源:frmRegistro.aspx.cs
示例4: DynamicTime
public DynamicTime()
{
_textBox = new TextBox();
_textBox.CausesValidation = false;
_mskEditExtender = new MaskedEditExtender();
_mskEditExtender.TargetControlID = _textBox.ID;
_mskEditExtender.Mask = "99:99";
_mskEditExtender.MaskType = MaskedEditType.Time;
_mskEditExtender.AcceptAMPM = false;
_mskEditExtender.UserTimeFormat = MaskedEditUserTimeFormat.TwentyFourHour;
_mskEditExtender.AutoComplete = true;
_mskEditValidator = new MaskedEditValidator();
_mskEditValidator.ControlExtender = _mskEditExtender.ID;
_mskEditValidator.ControlToValidate = _textBox.ID;
_mskEditValidator.EnableClientScript = true;
_mskEditValidator.Display = ValidatorDisplay.Dynamic;
_mskEditValidator.InvalidValueBlurredMessage = "*";
_mskEditValidator.InvalidValueMessage = "invalid value message";
_mskEditValidator.EmptyValueMessage = "empty value message";
_mskEditValidator.EmptyValueBlurredText = "*";
this.Controls.Add(_textBox);
this.Controls.Add(_mskEditExtender);
this.Controls.Add(_mskEditValidator);
this._timePickerXml = new DynamicTimeXml();
}
开发者ID:danilocecilia,项目名称:HulcherProject,代码行数:29,代码来源:DynamicTime.cs
示例5: CreateTextTemplate
public static SimpleFieldTemplateUserControl CreateTextTemplate(MetaColumn column, bool readOnly) {
SimpleFieldTemplateUserControl control = new SimpleFieldTemplateUserControl();
if (readOnly) {
var literal = new Literal();
literal.DataBinding += (sender, e) => {
literal.Text = control.FieldValueString;
};
control.Controls.Add(literal);
}
else {
var textBox = new TextBox();
textBox.DataBinding += (sender, e) => {
textBox.Text = control.FieldValueEditString;
};
// Logic copied from BoundField
if (column.ColumnType.IsPrimitive) {
textBox.Columns = 5;
}
control._valueExtrator = () => textBox.Text;
textBox.CssClass = "DDTextBox";
textBox.ID = TextBoxID;
control.Controls.Add(textBox);
control.CreateValidators(column);
}
return control;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:27,代码来源:SimpleFieldTemplateUserControl.cs
示例6: AddEditor
/// <summary>
/// Creates a multi-line <see cref="System.Web.UI.WebControls.TextBox">TextBox</see> with a class
/// called 'markdown-editor'. All Javascript and CSS files are added to the page.
/// </summary>
protected override System.Web.UI.Control AddEditor(System.Web.UI.Control container)
{
Page page = HttpContext.Current.Handler as System.Web.UI.Page;
if (page == null)
{
Literal literalError = new Literal() { Text = "unable to get current page from HttpContext.Current.Handler!" };
container.Controls.Add(literalError);
return literalError;
}
else
{
page.Header.Controls.Add(new Literal() { Text = "<link rel=\"stylesheet\" type=\"text/css\" href=\"/Addons/Markdown/Wmd/wmd.css\" />" });
page.Header.Controls.Add(new Literal() { Text = "<script type=\"text/javascript\" src=\"/Addons/Markdown/Wmd/showdown.js\"></script>" });
page.Header.Controls.Add(new Literal() { Text = "<script type=\"text/javascript\" src=\"/Addons/Markdown/Wmd/wmd.js\"></script>" });
container.Controls.Add(new Literal() { Text = "<div id=\"wmd-button-bar\" class=\"wmd-panel\"></div>" });
// Make the control
TextBox textbox = new TextBox();
textbox.CssClass = "wmd-panel wmd-textarea";
textbox.TextMode = TextBoxMode.MultiLine;
container.Controls.Add(textbox);
return textbox;
}
}
开发者ID:hemonnet,项目名称:hemonnet,代码行数:32,代码来源:WmdEditorAttribute.cs
示例7: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
pnlAttrtype = new Panel();
pnlAttrtype.ID = "pnl" + _ProfileAttributeType.Type;
lblAtriTypeName = new Label();
System.Web.UI.HtmlControls.HtmlGenericControl br = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
lblAtriTypeName.Text = _ProfileAttributeType.Type;
pnlAttrtype.Controls.Add(lblAtriTypeName);
pnlAttrtype.Controls.Add(br);
this.Controls.Add(pnlAttrtype);
_ProfileAttribute = _Repository.GetProfileAttributesByProfileIDAndType(_profile.ProfileID, _ProfileAttributeType.ProfileAttributeTypeID);
foreach (ProfileAttribute attribute in _ProfileAttribute)
{
System.Web.UI.HtmlControls.HtmlGenericControl brTab = new System.Web.UI.HtmlControls.HtmlGenericControl("br");
Label label = new Label();
label.Width = 200;
label.Height = 20;
label.ID = "lbl" + attribute.ProfileAttributeName;
label.Text = attribute.ProfileAttributeName;
TextBox textbox = new TextBox();
textbox.Width = 250;
textbox.Height = 20;
textbox.ID = "txt" + attribute.ProfileAttributeName;
textbox.Text = attribute.Response;
pnlAttrtype.Controls.Add(label);
pnlAttrtype.Controls.Add(textbox);
pnlAttrtype.Controls.Add(brTab);
}
}
开发者ID:ngocpq,项目名称:MHX2,代码行数:29,代码来源:ProfileAttributeControl.ascx.cs
示例8: CreateChildControls
protected override void CreateChildControls()
{
Random random = new Random();
_firstInt = random.Next(0, 20);
_secondInt = random.Next(0, 20);
ResourceManager rm = new ResourceManager("SystemWebExtensionsAUT.LocalizingClientResourcesWalkthrough.VerificationResources", this.GetType().Assembly);
Controls.Clear();
_firstLabel = new Label();
_firstLabel.ID = "firstNumber";
_firstLabel.Text = _firstInt.ToString();
_secondLabel = new Label();
_secondLabel.ID = "secondNumber";
_secondLabel.Text = _secondInt.ToString();
_answer = new TextBox();
_answer.ID = "userAnswer";
_button = new Button();
_button.ID = "Button";
_button.Text = rm.GetString("Verify");
_button.OnClientClick = "return CheckAnswer();";
Controls.Add(_firstLabel);
Controls.Add(new LiteralControl(" + "));
Controls.Add(_secondLabel);
Controls.Add(new LiteralControl(" = "));
Controls.Add(_answer);
Controls.Add(_button);
}
开发者ID:nobled,项目名称:mono,代码行数:32,代码来源:ClientVerification.cs
示例9: AttachChildControls
protected override void AttachChildControls()
{
this.txtShipTo = (TextBox) this.FindControl("txtShipTo");
this.txtAddress = (TextBox) this.FindControl("txtAddress");
this.txtZipcode = (TextBox) this.FindControl("txtZipcode");
this.txtTelPhone = (TextBox) this.FindControl("txtTelPhone");
this.txtCellPhone = (TextBox) this.FindControl("txtCellPhone");
this.dropRegionsSelect = (RegionSelector) this.FindControl("dropRegions");
this.btnAddAddress = ButtonManager.Create(this.FindControl("btnAddAddress"));
this.btnCancel = ButtonManager.Create(this.FindControl("btnCancel"));
this.btnEditAddress = ButtonManager.Create(this.FindControl("btnEditAddress"));
this.dtlstRegionsSelect = (Common_Address_AddressList) this.FindControl("list_Common_Consignee_ConsigneeList");
this.lblAddressCount = (Literal) this.FindControl("lblAddressCount");
this.btnAddAddress.Click += new EventHandler(this.btnAddAddress_Click);
this.btnEditAddress.Click += new EventHandler(this.btnEditAddress_Click);
this.btnCancel.Click += new EventHandler(this.btnCancel_Click);
this.dtlstRegionsSelect.ItemCommand += new Common_Address_AddressList.CommandEventHandler(this.dtlstRegionsSelect_ItemCommand);
PageTitle.AddSiteNameTitle("我的收货地址", HiContext.Current.Context);
if (!this.Page.IsPostBack)
{
this.lblAddressCount.Text = HiContext.Current.Config.ShippingAddressQuantity.ToString();
this.dropRegionsSelect.DataBind();
this.Reset();
this.btnEditAddress.Visible = false;
this.BindList();
}
}
开发者ID:davinx,项目名称:himedi,代码行数:27,代码来源:UserShippingAddresses.cs
示例10: InvokePopupCal
/// <summary>
/// Opens a popup Calendar
/// </summary>
/// <param name="Field">TextBox to return the date value</param>
/// <returns></returns>
/// <remarks>
/// </remarks>
public static string InvokePopupCal( TextBox Field )
{
// Define character array to trim from language strings
char[] TrimChars = new char[] {',', ' '};
// Get culture array of month names and convert to string for
// passing to the popup calendar
string MonthNameString = "";
foreach( string Month in DateTimeFormatInfo.CurrentInfo.MonthNames )
{
MonthNameString += Month + ",";
}
MonthNameString = MonthNameString.TrimEnd( TrimChars );
// Get culture array of day names and convert to string for
// passing to the popup calendar
string DayNameString = "";
foreach( string Day in DateTimeFormatInfo.CurrentInfo.AbbreviatedDayNames )
{
DayNameString += Day + ",";
}
DayNameString = DayNameString.TrimEnd( TrimChars );
// Get the short date pattern for the culture
string FormatString = DateTimeFormatInfo.CurrentInfo.ShortDatePattern.ToString();
if( !ClientAPI.IsClientScriptBlockRegistered( Field.Page, "PopupCalendar.js" ) )
{
ClientAPI.RegisterClientScriptBlock( Field.Page, "PopupCalendar.js", "<script src=\"" + ClientAPI.ScriptPath + "PopupCalendar.js\"></script>" );
}
string strToday = ClientAPI.GetSafeJSString( Localization.GetString( "Today" ) );
string strClose = ClientAPI.GetSafeJSString( Localization.GetString( "Close" ) );
string strCalendar = ClientAPI.GetSafeJSString( Localization.GetString( "Calendar" ) );
return "javascript:popupCal('Cal','" + Field.ClientID + "','" + FormatString + "','" + MonthNameString + "','" + DayNameString + "','" + strToday + "','" + strClose + "','" + strCalendar + "'," + (int)DateTimeFormatInfo.CurrentInfo.FirstDayOfWeek + ");";
}
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:42,代码来源:Calendar.cs
示例11: MoreInformation
internal static void MoreInformation(string UserName, TextBox txtField, string field)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString);
string str = "select * from moreinformation where user_id = @id";
SqlCommand cmd = new SqlCommand(str, con);
cmd.Parameters.AddWithValue("id", LoGiN.UserId(UserName));
try
{
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
dr.Read();
txtField.Text = dr[field].ToString();
}
}
catch (Exception)
{
throw new ApplicationException("Не удалось отобразить дополнительную информацию");
}
finally
{
con.Close();
}
}
开发者ID:juchok,项目名称:testKnowlige,代码行数:25,代码来源:Profile.cs
示例12: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
LogTitle = (TextBox)Skin.FindControl("LogTitle");
Search = (Button)Skin.FindControl("Search");
Search.Click += new EventHandler(Search_Click);
//throw new NotImplementedException();
}
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:7,代码来源:SearchLog.cs
示例13: InitializeSkin
protected override void InitializeSkin(System.Web.UI.Control Skin)
{
KeyWords=(TextBox)Skin.FindControl("KeyWords");
AllowPsd = (CheckBox)Skin.FindControl("AllowPsd");
IsEnReply = (CheckBox)Skin.FindControl("IsEnReply");
IsIndexShow = (CheckBox)Skin.FindControl("IsIndexShow");
AllowPsd.Attributes.Add("onclick", "AllowPsd()");
TextBox1 = (TextBox)Skin.FindControl("TextBox1");
TextBox2 = (TextBox)Skin.FindControl("TextBox2"); //js把logId写入
CreateTime = (TextBox)Skin.FindControl("CreateTime");
if (!Page.IsPostBack)
{
CreateTime.Text = DateTime.Now.ToString();
}
LogIdTex = (TextBox)Skin.FindControl("LogId");//没有用到啊···
Title = (TextBox)Skin.FindControl("title");
Add = (Button)Skin.FindControl("Add");
AddDraft = (Button)Skin.FindControl("AddDraft");
Cansel = (Button)Skin.FindControl("Cansel");
Editor = (TextBox)Skin.FindControl("txtContent");
LogCategory = (DropDownList)Skin.FindControl("LogCategory");
this.DataBind();
}
开发者ID:LittlePeng,项目名称:ncuhome,代码行数:25,代码来源:AddLog.cs
示例14: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
HtmlForm frm = (HtmlForm)FindControl("Form1");
GHTTestBegin(frm);
// Negative Rows value:
GHTSubTestBegin("Negative Rows value");
try
{
System.Web.UI.WebControls.TextBox tb = new System.Web.UI.WebControls.TextBox();
//tb.TextMode = TextBoxMode.MultiLine
tb.Rows = -1;
GHTSubTestExpectedExceptionNotCaught("ArgumentOutOfRangeException");
}
catch (ArgumentOutOfRangeException ex)
{
GHTSubTestExpectedExceptionCaught(ex);
}
catch (Exception ex)
{
GHTSubTestUnexpectedExceptionCaught(ex);
}
GHTSubTestEnd();
GHTTestEnd();
}
开发者ID:nobled,项目名称:mono,代码行数:26,代码来源:TextBox_Rows.aspx.cs
示例15: InitializeDataCell
protected override void InitializeDataCell(DataControlFieldCell cell, DataControlRowState rowState)
{
//base.InitializeDataCell(cell, rowState);
TextBox textBox = new TextBox();
textBox.ID = this.ControlID;
textBox.Width = new Unit(GridColumn.Width, UnitType.Pixel);
if (GridColumn.Size != 0) textBox.MaxLength = GridColumn.Size;
textBox.DataBinding += new EventHandler(this.textBox_DataBinding);
base.InitializeDataCell(cell, rowState);
cell.Controls.Add(textBox);
CompareValidator vld = new CompareValidator();
vld.ControlToValidate = textBox.ID;
vld.ID = textBox.ID + "vld";
vld.Operator = ValidationCompareOperator.DataTypeCheck;
vld.ErrorMessage = "не верный формат (2)";
vld.Text = "! (2)";
vld.Display = ValidatorDisplay.Dynamic;
if (GridColumn.Type == typeof(int)) vld.Type = ValidationDataType.Integer;
if (GridColumn.Type == typeof(decimal)) vld.Type = ValidationDataType.Double;
if (GridColumn.Type == typeof(string)) vld.Type = ValidationDataType.String;
cell.Controls.Add(vld);
if (!GridColumn.AllowNULL)
{
RequiredFieldValidator reqvld = new RequiredFieldValidator();
reqvld.ControlToValidate = textBox.ID;
reqvld.ID = textBox.ID + "reqvld";
reqvld.ErrorMessage = "поле не может быть пустым (1)";
reqvld.Text = "! (1)";
reqvld.Display = ValidatorDisplay.Dynamic;
cell.Controls.Add(reqvld);
}
}
开发者ID:vahtel65,项目名称:Aspect_loc,代码行数:32,代码来源:TextBoxProductGridField.cs
示例16: Page_Load
private void Page_Load(object sender, System.EventArgs e)
{
HtmlForm frm = (HtmlForm)this.FindControl("Form1");
GHTTestBegin(frm);
// Negative columns value - Shoud throw an exception:
GHTSubTestBegin("Negative columns value");
try
{
System.Web.UI.WebControls.TextBox tb = new System.Web.UI.WebControls.TextBox();
tb.Columns = -1;
GHTSubTestExpectedExceptionNotCaught("ArgumentOutOfRangeException");
}
catch (ArgumentOutOfRangeException ex)
{
GHTSubTestExpectedExceptionCaught(ex);
}
catch (Exception ex)
{
GHTSubTestUnexpectedExceptionCaught(ex);
}
GHTSubTestEnd();
GHTTestEnd();
}
开发者ID:nobled,项目名称:mono,代码行数:25,代码来源:TextBox_Columns.aspx.cs
示例17: LogoSourceSelectionList_SelectedIndexChanged
protected void LogoSourceSelectionList_SelectedIndexChanged(object sender, EventArgs e)
{
if (LogoSourceSelectionList.SelectedValue == "Computer")
{
Label LogoLabel = new Label();
Label BreakLine = new Label();
FileUpload LogotypeFileUpload = new FileUpload();
BreakLine.Text = "<br />";
LogoLabel.Text = "Please select an image from your computer:";
LogotypePlaceHolder.Controls.Add(LogoLabel);
LogotypePlaceHolder.Controls.Add(BreakLine);
LogotypePlaceHolder.Controls.Add(LogotypeFileUpload);
}
if (LogoSourceSelectionList.SelectedValue == "Internet")
{
Label LogoLabel = new Label();
Label BreakLine = new Label();
TextBox LogoUrlTextBox = new TextBox();
BreakLine.Text = "<br />";
LogoLabel.Text = "Please specify the URL to the location of your logotype. Please make sure to specify an absolute path such as: http://www.something.com/image.png";
LogoUrlTextBox.Text = "http://";
LogotypePlaceHolder.Controls.Add(LogoLabel);
LogotypePlaceHolder.Controls.Add(BreakLine);
LogotypePlaceHolder.Controls.Add(LogoUrlTextBox);
}
}
开发者ID:Zimpe,项目名称:Kawanoikioi,代码行数:26,代码来源:Settings.aspx.cs
示例18: AddLastValueHiddenField
private void AddLastValueHiddenField(Panel p)
{
this.lastValueHiddenTextBox = new TextBox();
this.lastValueHiddenTextBox.ID = "LastValueHidden";
this.lastValueHiddenTextBox.Style.Add("display", "none;");
p.Controls.Add(this.lastValueHiddenTextBox);
}
开发者ID:njmube,项目名称:mixerp,代码行数:7,代码来源:GridPanel.cs
示例19: ChangeVisible
private void ChangeVisible(int index, DropDownList dropDownList, TextBox txtBox)
{
if (index == 1)
dropDownList.Style["visibility"] = "visible";
if(index == 2)
txtBox.Style["visibility"] = "visible";
}
开发者ID:juliakolesen,项目名称:voobrazi.by,代码行数:7,代码来源:IndividualOrderControl.ascx.cs
示例20: AddValidatorSettingsEdit
public override void AddValidatorSettingsEdit(Control parentCtrl)
{
Portal.API.Controls.Label lbl = new Portal.API.Controls.Label();
lbl.LanguageRef = "MinimumLength";
parentCtrl.Controls.Add(lbl);
// Minimale Länge.
TextBox lengthBox = new TextBox();
lengthBox.ID = "_minLength";
int length = 0;
if(TryGetProperty("MinimumLength", ref length))
lengthBox.Text = length.ToString();
parentCtrl.Controls.Add(lengthBox);
parentCtrl.Controls.Add(new LiteralControl("</br>"));
// Maximale Länge.
lbl = new Portal.API.Controls.Label();
lbl.LanguageRef = "MaximumLength";
parentCtrl.Controls.Add(lbl);
lengthBox = new TextBox();
lengthBox.ID = "_maxLength";
if (TryGetProperty("MaximumLength", ref length))
lengthBox.Text = length.ToString();
parentCtrl.Controls.Add(lengthBox);
}
开发者ID:dineshkummarc,项目名称:Portal-V2.8.1,代码行数:29,代码来源:ValidatorText.cs
注:本文中的System.Web.UI.WebControls.TextBox类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论