Text in a textbox

Hi there - I have a simple query:
I am looking for some javascript code for an email text box:.
When the page loads the text in the text box will state
"Enter email address"
When the user clicks in the text box - the text will disappear allowing the user to write his/her email address.
Thank you

I am looking for some javascript code for an email
text box:.And why are you looking for code in Netscape's Javascript in Sun's Java forum?
When the user clicks in the text box - the text will
disappear allowing the user to write his/her email
address.For what it's worth: catch the onClick event and set the textbox's value to "".

Similar Messages

  • Change background of the text in a TextBox

    (JavaFX 1.3) How can one change the background (color, gradient, whatever) of the text in a TextBox without affecting any of the other display (Skin) attributes for the TextBox?
    A related question is: How can I programmatically determine the background (color, gradient, whatever) of the text in a TextBox?
    I would like to be able to indicate to the user that the text entered is not valid by changing the background of the text to something other than the original background and change it back to the original background when the text is valid. This would probably be done inside overridden replaceSelection and/or commit functions when extending a TextBox.

    This seems to change the background of a button from the caspian style to something else and back to the caspian style, without losing the focus highlight.
    // caspianFXBodyColor = definition of -fx-body-color in .scene from caspian.css
    def caspianFXBodyColor = "linear (0%,0%) to (0%,100%) stops (0,derive(-fx-color,34%)) (1,derive(-fx-color,-18%))";
    def revisedFXBodyColor = "red";
    Stage {
      scene: Scene {
        width: 250
        height: 300
        content: Button {
          var isCaspian = true;
          var bodyColor: String = caspianFXBodyColor;
          text: "push me"
          style: bind "-fx-body-color: {bodyColor};"
          action: function() {
            if (isCaspian = not isCaspian) bodyColor = caspianFXBodyColor
            else bodyColor = revisedFXBodyColor;
    }However, the original question regarding how to do this for a TextBox remains unanswered. The following code demonstrates that changing the value for -fx-background-color changes the background color as desired, but the focus highlight is lost. Changing the value of -fx-body-color has no visible effect.
    // caspianBGColor = definition of -fx-background-color in .text-box{} in caspian.css
    def caspianBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, -fx-control-inner-background;";
    def revisedBGColor = "-fx-background-color: -fx-shadow-highlight-color, -fx-text-box-border, red;";
    def caspianBodyColor = "-fx-body-color: -fx-control-inner-background;";
    def revisedBodyColor = "-fx-body-color: red;";
    def box = TextBox { text: "sample text" }
    var isCaspianBackground = true;
    var isCaspianBody = true;
    def button1 = Button {
      text: bind "change {if (isCaspianBackground) 'from' else 'to'} caspian background color"
      action: function() {
        if (isCaspianBackground) box.style = revisedBGColor else box.style = caspianBGColor;
        isCaspianBackground = not isCaspianBackground;
    def button2 = Button {
      text: bind "change {if (isCaspianBody) 'from' else 'to'} caspian body color"
      action: function() {
        if (isCaspianBody) box.style = revisedBodyColor else box.style = caspianBodyColor;
        isCaspianBody = not isCaspianBody;
    Stage {
      scene: Scene {
        width: 250
        height: 300
        content: [ VBox { content: [ box, button1, button2 ] } ]
    }Edited by: timdoodle on Aug 13, 2010 5:25 PM
    Code was not displayed correctly. Some text inside braces was not displayed.

  • Justifying a text in a textbox

    I've got a ridiculous problem, but there's no way to find the way.
    The think is that I can't justify the text in a textbox of a book.
    I found a similar post in that forum that solves the problem. There is said that I've to select the textbox and not the text and a different menu will appear. There's no way to select the textbox...
    I understand it looks like a ridiculous question, but really, I don't know how to do it.
    thank you everyone!

    I've found it at the "MoreLikeThis" frame.
    Just shake it! Then appear a window with a undo-function.
    Thanks!

  • Change the background color of a particular word without changing the background color of the rest of the text in a textbox

    Hello,
    I'm designing my own website and want to know how to change the background color of a particular word without changing the background color of the rest of the text in a textbox. If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Thank you very much!
    Roger.

    If i can't do this, how can I create a Table, similar to Excel with iWeb?
    Read this :
         Create and add a TABLE in iWeb »
         More about a TABLE in iWeb »
         Sample 1
         Sample 2

  • Vertically center text in a textbox

    Like Indesign, a way to vertically justify or center a text in a textbox.

    I don't know if there is a way to automatically center the text, but you can play with padding, if font size and height are fixed:
    .text-box *.viewport {
        -fx-padding: 15 5 3 5;
    // Tested with:
    TextBox
        text: "Hello World"
        columns: 12
        selectOnFocus: true
        layoutInfo: LayoutInfo { height: 50 }
    }

  • How to paste image and text in same textbox.

    Is it possible to paste image and text in same textbox
    or anyother swing component.

    See http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html for information about styled-text displays, including text/image combinations
    Doug

  • Different coloured text in one Textbox

    Can someone PLEASE help me!!!!!!!!!!!!!!
    I need to know how to have different coloured text in the same textbox.
    My application has text being inputted into the textbox every 5 seconds from 2 different sources. I want to differenciate the text by showing the user 2 different colours for each source.
    Thank you very much

    Acording to the first post it also shows data, so it is a GUI component. i never sow a textbox.
    JTextPane can show data in different colors. also JTextArea can.
    Noah

  • Composite control - change text property of textbox from .cs file

    Hi All,
    I have created a composite control with dropdowns and hiddenfield for datepicker. Now when I change the value of dropdown from browser - client side then its value is retained on postback. But when I change value programmatically its not reflected on
    screen.
    using System;
    using System.Text;
    using System.Collections;
    using System.Collections.Generic;
    using System.Globalization;
    using System.ComponentModel;
    using System.Drawing;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.Design;
    using System.Web.UI.WebControls;
    using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
    namespace GOV.Framework.Portal.Controls
    /// <summary>
    /// Simple DateTimePicker control that uses jQuery UI DatePicker to pop up
    /// a date, time or both picker.
    /// </summary>
    [ToolboxBitmap(typeof(System.Web.UI.WebControls.Calendar)), DefaultProperty("SelectedValue"),
    ToolboxData("<{0}:DateTimePicker runat=\"server\"></{0}:DateTimePicker>"), PersistenceMode(PersistenceMode.InnerProperty)]
    public class DateTimePicker : WebControl
    #region "Global Variables"
    public enum DisplayControls
    TextBox,
    Dropdown
    public enum DisplayModes
    Button,
    ImageButton,
    AutoPopup,
    Inline,
    public enum DisplayTypes
    Time,
    Date,
    DateTime
    public enum DisplayMonthTypes
    Full,
    Short
    private enum DisplayYearTypes
    Full,
    Short
    private DropDownList ddlDay = new DropDownList();
    private DropDownList ddlMonth = new DropDownList();
    private DropDownList ddlYear = new DropDownList();
    private TextBox txtDate = new TextBox();
    private Label lblMsg = new Label();
    private System.Web.UI.WebControls.Image imgCal = new System.Web.UI.WebControls.Image();
    private HiddenField hdnDate = new HiddenField();
    private DisplayModes _DisplayMode = DisplayModes.ImageButton;
    private DisplayControls _DisplayControl = DisplayControls.TextBox;
    private DisplayTypes _DisplayType = DisplayTypes.DateTime;
    private int _StepMinutes = 1;
    private int _StepHours = 1;
    private DateTime? _MinDate = null;
    private DateTime? _MaxDate = null;
    private string _OnClientSelect = "";
    private string _ButtonImage = "../Images/calendar.png";
    private string _CalendarCss = "WebResource";
    private string _CalendarJs = "../scripts/timepicker.js";
    private DisplayMonthTypes _DisplayMonthType = DisplayMonthTypes.Full;
    private DisplayYearTypes _DisplayYearType = DisplayYearTypes.Full;
    private int _minYear = DateTime.Now.Year - 25;
    private int _maxYear = DateTime.Now.Year;
    private int _minMonth = 1;
    private int _maxMonth = 31;
    private int _minDay = 1;
    private int _maxDay = 28;
    private string _dateControlClientId = string.Empty;
    DateTime? _SelectedDate = null;
    private bool _DisplayMessageLabel = true;
    private short _tabIndex;
    private const string vwst_SelectedDate = "_SelectedDate";
    #region "ErrorMessages"
    private const string SelectedDate_GreaterThan_MaxDate = "SelectedDate can not be greater than MaxDate";
    private const string MaxDate_LessThan_SelectedDate = "MaxDate can not be less than SelectedDate";
    private const string SelectedDate_LessThan_MinDate = "SelectedDate can not be less than MinDate";
    private const string MinDate_GreaterThan_SelectedDate = "MinDate can not be greater than SelectedDate";
    #endregion
    #endregion
    #region "Properties"
    #region "Private Properties"
    [Description("Determines display full or short(yy) year")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "string")]
    private DisplayYearTypes DisplayYearType
    get
    return _DisplayYearType;
    set
    _DisplayYearType = value;
    [Description("Determines minimum year to be displayed in dropdown : Default currentyear - 25")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "int")]
    private int MinYear
    get
    if (MinDate != null)
    _minYear = MinDate.Value.Year;
    else
    _minYear = DateTime.Now.Year - 25;
    return _minYear;
    //set
    // _minDisplayYear = value;
    [Description("Determines maximum year to be displayed in dropdown : Default currentyear")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "int")]
    private int MaxYear
    get
    if (MaxDate != null)
    _maxYear = MaxDate.Value.Year;
    else
    _maxYear = DateTime.Now.Year;
    return _maxYear;
    //set
    // _maxDisplayYear = value;
    private string DateControlClientId
    get
    if (DisplayControl == DisplayControls.Dropdown)
    _dateControlClientId = hdnDate.ClientID;
    else
    _dateControlClientId = txtDate.ClientID;
    return _dateControlClientId;
    [Description("Determines minimum month of min date : default 1")]
    [Category("DateTime Selection"), DefaultValue(1)]
    private int minMonth
    get
    if (MinDate != null)
    _minMonth = MinDate.Value.Month;
    else
    _minMonth = 1;
    return _minMonth;
    [Description("Determines max months of max date: Default 12")]
    [Category("DateTime Selection"), DefaultValue(12)]
    private int maxMonth
    get
    if (MaxDate != null)
    _maxMonth = MaxDate.Value.Month;
    else
    _maxMonth = 1;
    return _maxMonth;
    [Description("Determines minimum day : Defualt 1")]
    [Category("DateTime Selection"), DefaultValue(1)]
    private int minDay
    get
    if (MinDate != null)
    _minDay = MinDate.Value.Day;
    else
    _minDay = 1;
    return _minDay;
    [Description("Determines max day: Defualt last day of max month")]
    [Category("DateTime Selection"), DefaultValue(30)]
    private int maxDay
    get
    if (MaxDate != null)
    _maxDay = MaxDate.Value.Day;
    else
    _maxDay = DateTime.DaysInMonth(MaxYear, maxMonth);
    return _maxDay;
    #endregion
    #region "Public Properties"
    /// <summary>
    /// The currently selected datetime
    /// </summary>
    [Category("DateTime Selection")]
    public DateTime? SelectedValue
    get
    DateTime dt = new DateTime();
    if (DisplayControl == DisplayControls.TextBox && txtDate.Text != "")
    DateTime.TryParse(txtDate.Text, out dt);
    else if (DisplayControl == DisplayControls.Dropdown && hdnDate.Value != "")
    DateTime.TryParse(hdnDate.Value, out dt);
    if (dt != null && dt != new DateTime())
    _SelectedDate = dt;
    else
    _SelectedDate = null;
    return _SelectedDate;
    set
    if (!value.HasValue)
    txtDate.Text = "";
    hdnDate.Value = "";
    else
    if (value != null && MinDate != null && value < MinDate)
    throw new ArgumentOutOfRangeException("SelectedValue", SelectedDate_LessThan_MinDate);
    if (value != null && MaxDate != null && value > MaxDate)
    throw new ArgumentOutOfRangeException("SelectedValue", SelectedDate_GreaterThan_MaxDate);
    string dateFormat = this.DateTimeFormat;
    //if ( dateFormat == "Auto")
    // dateFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
    if (DisplayControl == DisplayControls.TextBox)
    txtDate.Text = value.Value.ToString(dateFormat);
    else if (DisplayControl == DisplayControls.Dropdown)
    hdnDate.Value = value.Value.ToString(dateFormat);
    _SelectedDate = value;
    if (DisplayControl == DisplayControls.Dropdown)
    setDropDownValue(value);
    [Description("Determines display textbox or dropdowns")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayModes), "TextBox")]
    public DisplayControls DisplayControl
    get { return _DisplayControl; }
    set { _DisplayControl = value; }
    [Description("Determines how the datepicking option is activated")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayModes), "ImageButton")]
    public DisplayModes DisplayMode
    get { return _DisplayMode; }
    set { _DisplayMode = value; }
    [Description("Determines what datetimepicker should return")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "DateTime")]
    public DisplayTypes DisplayType
    get
    return _DisplayType;
    set
    _DisplayType = value;
    [Description("Increment minute factor when using the time picker.")]
    [Category("DateTime Selection"), DefaultValue(1)]
    public int StepMinutes
    get
    return _StepMinutes;
    set
    _StepMinutes = value;
    [Description("Increment hour factor when using the time picker.")]
    [Category("DateTime Selection"), DefaultValue(1)]
    public int StepHours
    get
    return _StepHours;
    set
    _StepHours = value;
    private string _DateTimeFormat = CultureInfo.CurrentCulture != null ? CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern : "dd/MM/yyyy";
    [Description("Determines the Date Format used. Auto uses CurrentCulture.DateTimeFormat.ShortDatePattern. Format: MM month, dd date, yyyy year symbol")]
    [Category("DateTime Selection"), DefaultValue("dd/MM/yyyy")]
    public string DateTimeFormat
    get
    return _DateTimeFormat;
    set
    _DateTimeFormat = value;
    [Description("Minumum allowable date. Leave blank to allow any date")]
    [Category("DateTime Selection"), DefaultValue(typeof(DateTime?), null)]
    public DateTime? MinDate
    get
    return _MinDate;
    set
    if (value != null && SelectedValue != null && value > SelectedValue)
    throw new ArgumentOutOfRangeException("MinDate", MinDate_GreaterThan_SelectedDate);
    _MinDate = value;
    [Description("Maximum allowable date. Leave blank to allow any date.")]
    [Category("DateTime Selection"), DefaultValue(typeof(DateTime?), null)]
    public DateTime? MaxDate
    get
    return _MaxDate;
    set
    if (value != null && SelectedValue != null && value < SelectedValue)
    throw new ArgumentOutOfRangeException("MaxDate", MaxDate_LessThan_SelectedDate);
    _MaxDate = value;
    [Description("Client event handler fired when a date is selected")]
    [Category("DateTime Selection"), DefaultValue("")]
    public string OnClientSelect
    get
    return _OnClientSelect;
    set
    _OnClientSelect = value;
    [Description("Url to a Calendar Image. Applies only if the DisplayMode = ImageButton")]
    [Category("DateTime Resource"), DefaultValue("../Images/calendar.png")]
    public string ButtonImage
    get { return _ButtonImage; }
    set { _ButtonImage = value; }
    [Category("DateTime Resource"), Description("The CSS that is used for the calendar or empty for default."), DefaultValue("WebResource")]
    public string CalendarCss
    get { return _CalendarCss; }
    set { _CalendarCss = value; }
    [Description("Location for the calendar JavaScript or empty for default.")]
    [Category("DateTime Resource"), DefaultValue("../scripts/timepicker.js")]
    public string CalendarJs
    get { return _CalendarJs; }
    set { _CalendarJs = value; }
    [Description("Determines what to Display full Month name or short month name")]
    [Category("DateTime Selection"), DefaultValue(typeof(DisplayTypes), "string")]
    public DisplayMonthTypes DisplayMonthType
    get
    return _DisplayMonthType;
    set
    _DisplayMonthType = value;
    [Description("Display static label for msg below date control")]
    [Category("DateTime Selection"), DefaultValue(true)]
    public bool DisplayMessageLable
    get { return _DisplayMessageLabel; }
    set { _DisplayMessageLabel = value; }
    [Bindable(true)]
    [DefaultValue("false")]
    public override short TabIndex
    get
    return _tabIndex;
    set
    _tabIndex = value;
    ddlDay.TabIndex = value;
    ddlMonth.TabIndex = value;
    ddlYear.TabIndex = value;
    imgCal.TabIndex = value;
    #endregion
    #endregion
    #region "Events"
    public DateTimePicker()
    this.Width = Unit.Pixel(80);
    /// <summary>
    /// Load all controls
    /// </summary>
    /// <param name="e"></param>
    protected override void OnInit(EventArgs e)
    base.OnInit(e);
    //Controls.Clear();
    //CreateAndAddControls();
    /// <summary>
    /// Add Child controls - Dropdowns and textbox;
    /// </summary>
    protected override void CreateChildControls()
    base.CreateChildControls();
    Controls.Clear();
    CreateAndAddControls();
    /// <summary>
    /// Load all controls
    /// </summary>
    /// <param name="e"></param>
    protected override void OnLoad(EventArgs e)
    base.OnLoad(e);
    if (DisplayControl == DisplayControls.Dropdown)
    if (ddlDay.Items.Count == 0 || ddlMonth.Items.Count == 0 || ddlYear.Items.Count == 0 || !Page.IsPostBack)
    FillDropdowns();
    generateDisplayMessage();
    protected override void LoadViewState(object savedState)
    base.LoadViewState(savedState);
    protected override void LoadControlState(object savedState)
    base.LoadControlState(savedState);
    protected override object SaveViewState()
    if (HasControls() && Page.IsPostBack)
    ddlDay.SelectedValue = "11";
    object obj = base.SaveViewState();
    return obj;
    protected override void TrackViewState()
    base.TrackViewState();
    /// <summary>
    /// Most of the work happens here for generating the hook up script code
    /// </summary>
    /// <param name="e"></param>
    protected override void OnPreRender(EventArgs e)
    base.OnPreRender(e);
    // Register resources
    this.RegisterResources();
    string script = GenerateScript();
    Page.ClientScript.RegisterStartupScript(this.GetType(), "_cal" + this.ID, script, true);
    /// <summary>
    /// Render Control
    /// </summary>
    /// <param name="writer"></param>
    public override void RenderControl(HtmlTextWriter writer)
    if (this.DisplayMode != DisplayModes.Inline)
    base.RenderControl(writer);
    else
    writer.Write("<div id='" + this.ClientID + "Div'></div>");
    if (HttpContext.Current == null)
    if (this.DisplayMode == DisplayModes.Button)
    writer.Write(" <input type='button' value='...' style='width: 20px; height: 20px;' />");
    else if ((this.DisplayMode == DisplayModes.ImageButton))
    string img;
    if (this.ButtonImage == "WebResource")
    img = this.Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.calendar.png");
    else
    img = this.ResolveUrl(this.ButtonImage);
    writer.AddAttribute(HtmlTextWriterAttribute.Src, img);
    writer.AddAttribute("hspace", "2");
    writer.RenderBeginTag(HtmlTextWriterTag.Img);
    writer.RenderEndTag();
    /// <summary>
    /// Render Control
    /// </summary>
    /// <param name="writer"></param>
    protected override void Render(HtmlTextWriter writer)
    RenderControls(writer);
    #endregion
    #region "Methods"
    /// <summary>
    /// Set properties of control
    /// </summary>
    private void CreateAndAddControls()
    txtDate.ID = "_txtDate";
    txtDate.CssClass = "dpDate";
    ddlDay.ID = "_ddlDay";
    ddlMonth.ID = "_ddlMonth";
    ddlYear.ID = "_ddlYear";
    imgCal.ID = "_imgCal";
    imgCal.CssClass = "trigger";
    imgCal.ImageUrl = this.ButtonImage;
    //imgCal.Visible = false;
    hdnDate.ID = "_hdnDate";
    lblMsg.ID = "_lblMsg";
    lblMsg.CssClass = "MsgLabel";
    if (DisplayControl == DisplayControls.Dropdown)
    txtDate.Visible = false;
    this.Controls.Add(ddlDay);
    this.Controls.Add(ddlMonth);
    this.Controls.Add(ddlYear);
    this.Controls.Add(hdnDate);
    else
    txtDate.Visible = true;
    this.Controls.Add(txtDate);
    this.Controls.Add(imgCal);
    this.Controls.Add(lblMsg);
    /// <summary>
    /// Add Controls to the control
    /// </summary>
    private void RenderControls(HtmlTextWriter writer)
    //if (ChildControlsCreated)
    // return;
    AddAttributesToRender(writer);
    writer.AddAttribute(HtmlTextWriterAttribute.Class, "datePickerTable", false);
    writer.RenderBeginTag(HtmlTextWriterTag.Table);//start of table
    writer.RenderBeginTag(HtmlTextWriterTag.Tr);//start of tr1
    if (DisplayControl == DisplayControls.Dropdown)
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlDay.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlMonth.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    ddlYear.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    hdnDate.RenderControl(writer);
    writer.RenderEndTag();
    else
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    txtDate.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    //Control ltrl1 = new LiteralControl();
    //writer.AddStyleAttribute(HtmlTextWriterStyle.Display, "None");
    //writer.RenderBeginTag(HtmlTextWriterTag.Div);
    ////ltrl1.RenderControl(writer);
    //imgCal.RenderControl(writer);
    //writer.RenderEndTag();//end of div
    writer.Write("<div style=\"display:none\">");
    imgCal.RenderControl(writer);
    writer.Write("</div>");
    writer.RenderEndTag();
    writer.RenderEndTag();//end of tr1
    writer.RenderBeginTag(HtmlTextWriterTag.Tr);//start of tr
    writer.AddAttribute(HtmlTextWriterAttribute.Colspan, "4", false);
    writer.RenderBeginTag(HtmlTextWriterTag.Td);
    lblMsg.RenderControl(writer);
    writer.RenderEndTag();
    writer.RenderEndTag();// end of tr2
    writer.RenderEndTag();// end of table
    //string newTable = "<table class='datePickerTable'";
    //string endTable = "</table>";
    //string newTr = "<tr>";
    //string endTr = "</tr>";
    //string newTd = "<td>";
    //string endTd = "</td>";
    ////Controls.Clear();
    //InitControls();
    //Controls.Add(new LiteralControl(newTable + newTr + newTd));
    //if (DisplayControl == DisplayControls.Dropdown)
    // Controls.Add(ddlDay);
    // Controls.Add(new LiteralControl(endTd + newTd));
    // Controls.Add(ddlMonth);
    // Controls.Add(new LiteralControl(endTd + newTd));
    // Controls.Add(ddlYear);
    // Controls.Add(new LiteralControl(endTd + newTd));
    //Controls.Add(txtDate);
    //Controls.Add(hdnDate);
    //Controls.Add(new LiteralControl(endTd + newTd));
    //Controls.Add(new LiteralControl("<div style=\"display:none\">"));
    //Controls.Add(imgCal);
    //Controls.Add(new LiteralControl("</div>"));
    //Controls.Add(new LiteralControl(endTd + endTr));
    //Controls.Add(new LiteralControl(newTr + "<td colspan=4>"));
    //Controls.Add(lblMsg);
    //Controls.Add(new LiteralControl(endTd + endTr + endTable));
    /// <summary>
    /// Code that embeds related resources (.js and css)
    /// </summary>
    /// <param name="scriptProxy"></param>
    protected void RegisterResources()
    // Load the calandar script
    string script = this.CalendarJs;
    // Load jQuery Calendar Scripts
    if (script == "WebResource")
    Page.ClientScript.RegisterClientScriptResource(this.GetType(), "jQueryDatePicker.Resources.ui.datepicker.js");
    else if (!string.IsNullOrEmpty(script))
    Page.ClientScript.RegisterClientScriptInclude(this.GetType(), "__jqueryCalendar", this.ResolveUrl(script));
    // Load the related CSS reference into the page
    script = this.CalendarCss;
    if (script == "WebResource")
    script = Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.ui.datepicker.css");
    else if (!string.IsNullOrEmpty(script))
    script = this.ResolveUrl(this.CalendarCss);
    // Register Calendar CSS 'manually'
    string css = @"<link href=""" + script + @""" type=""text/css"" rel=""stylesheet"" />";
    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_calcss", css, false);
    /// <summary>
    /// Converts a date to a JavaScript date string in UTC format
    /// </summary>
    /// <param name="date"></param>
    /// <returns></returns>
    private static string EncodeJsDate(DateTime date)
    return "new Date(\"" + date.ToString("U") + " UTC" + "\")";
    /// <summary>
    /// Generate Javascript for Datepicker plugin
    /// </summary>
    /// <returns></returns>
    private string GenerateScript()
    // To capture and map the various option parameters
    StringBuilder sbOptions = new StringBuilder(512);
    sbOptions.Append("{");
    //jQuey Script
    StringBuilder sbStartupScript = new StringBuilder(400);
    sbStartupScript.AppendLine("jQuery(document).ready( function() {");
    string dateFormat = this.DateTimeFormat;
    if (!string.IsNullOrEmpty(dateFormat))
    dateFormat = this.DateTimeFormat.Replace("MMM", "M").Replace("MM", "mm");
    sbOptions.Append("dateFormat: '" + dateFormat + "'");
    //string onSelect = this.OnClientSelect;
    if (this.DisplayMode == DisplayModes.Button)
    sbOptions.Append(",showOnFocus: false, showTrigger: '<button type=\"button\" class=\"trigger\">...</button>'");
    else if (this.DisplayMode == DisplayModes.ImageButton)
    string img = this.ButtonImage;
    if (img == "WebResource")
    img = Page.ClientScript.GetWebResourceUrl(this.GetType(), "jQueryDatePicker.Resources.calendar.png");
    else
    img = this.ResolveUrl(this.ButtonImage);
    sbOptions.Append(",showOnFocus: false, showTrigger: '#" + imgCal.ClientID + "'");
    sbOptions.Append(", onSelect: DateSelectedFromCalendar ");
    if (this.MinDate.HasValue)
    sbOptions.Append(",minDate: new Date(" + MinDate.Value.Year.ToString() + "," + (MinDate.Value.Month - 1).ToString() + "," + MinDate.Value.Day.ToString() + ")");
    if (this.MaxDate.HasValue)
    sbOptions.Append(",maxDate: new Date(" + MaxDate.Value.Year.ToString() + "," + (MaxDate.Value.Month - 1).ToString() + "," + MaxDate.Value.Day.ToString() + ")");
    sbOptions.Append(",yearRange:' " + this.MinYear.ToString() + ":" + this.MaxYear.ToString() + "'");
    //end of options
    sbOptions.Append("}");
    // Write out initilization code for calendar
    if (this.DisplayMode != DisplayModes.Inline)
    sbStartupScript.AppendLine("var cal = jQuery('#" + this.DateControlClientId + "').datepick(" + sbOptions.ToString() + ");");
    else
    sbStartupScript.AppendLine("var cal = jQuery('#" + this.ClientID + "Div').datepick(" + sbOptions.ToString() + ");");
    sbStartupScript.AppendLine("var dp = jQuery.datepicker;");
    if (this.SelectedValue.HasValue && this.SelectedValue.Value > new DateTime(1900, 1, 1, 0, 0, 0, DateTimeKind.Utc))
    sbStartupScript.AppendLine("dp.setDateFor(cal[0],new Date('" + txtDate.Text + "'));");
    sbStartupScript.AppendLine("dp.reconfigureFor(cal[0]);");
    //******************* When dropdown changes then reflect it in calendar
    if (DisplayControl == DisplayControls.Dropdown)
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.Append("$('#" + ddlDay.ClientID);
    sbStartupScript.Append(",#" + ddlMonth.ClientID);
    sbStartupScript.Append(",#" + ddlYear.ClientID + "').change(function() {");
    // disable months and days when they are less then day months of minimum date
    sbStartupScript.Append("$ddlDay=$('#" + ddlDay.ClientID + "');");
    sbStartupScript.Append("$ddlMonth=$('#" + ddlMonth.ClientID + "');");
    sbStartupScript.Append("$ddlYear=$('#" + ddlYear.ClientID + "');");
    sbStartupScript.AppendLine("var minYear=" + this.MinYear.ToString() + ";");
    ///disable months of minimum year which are less then minumum date month
    sbStartupScript.AppendLine("if($ddlYear.val()<=minYear && $('#" + this.DateControlClientId + "').val!=''){ alert('true');");
    sbStartupScript.AppendLine("var minMonth=" + this.minMonth.ToString() + ";");
    sbStartupScript.AppendLine("if($ddlMonth.val()<=minMonth){");//start of if of minMonth
    sbStartupScript.AppendLine("$ddlMonth.val(minMonth);");
    sbStartupScript.AppendLine("var minDay=" + this.minDay.ToString() + ";");
    sbStartupScript.AppendLine("$ddlMonth.find('option:lt('+minMonth+')').hide();");
    sbStartupScript.AppendLine("if($ddlDay.val()<=minDay)");
    sbStartupScript.AppendLine("$ddlDay.val(minDay);");
    sbStartupScript.AppendLine("}");// end of if of minMonth
    sbStartupScript.AppendLine("else {");
    sbStartupScript.AppendLine("$ddlDay.find('option').show();");
    sbStartupScript.AppendLine("}");// end of else part of min month
    sbStartupScript.AppendLine("$ddlDay.find('option:lt('+minDay+')').hide();");
    sbStartupScript.AppendLine("}");// end of if part of min Year
    sbStartupScript.AppendLine("else {");
    sbStartupScript.AppendLine("$ddlMonth.find('option').show();");
    sbStartupScript.AppendLine("}");// end of else part of min Year
    ///set date in calendar
    sbStartupScript.AppendLine();
    sbStartupScript.Append("$('#" + this.DateControlClientId + "').datepick('setDate', new Date(\n\r\r ");
    sbStartupScript.Append("$('#" + ddlYear.ClientID + "').val(),");
    sbStartupScript.Append("$('#" + ddlMonth.ClientID + "').val()-1,");
    sbStartupScript.Append("$('#" + ddlDay.ClientID + "').val()));");
    sbStartupScript.AppendLine("} );");
    //******************* When calendar changes then reflect it in dropdown
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.AppendLine("function DateSelectedFromCalendar(dates) {");
    if (DisplayControl == DisplayControls.Dropdown)
    sbStartupScript.AppendLine("$('#" + ddlDay.ClientID + "').val(dates.length ? dates[0].getDate() : '');");
    sbStartupScript.AppendLine("$('#" + ddlMonth.ClientID + "').val(dates.length ? dates[0].getMonth() +1 : '');");
    sbStartupScript.AppendLine("$('#" + ddlYear.ClientID + "').val(dates.length ? dates[0].getFullYear() : '');");
    if (!string.IsNullOrEmpty(this.OnClientSelect))
    sbStartupScript.AppendLine(this.OnClientSelect + "();");
    sbStartupScript.AppendLine("}");
    //******************* Validation Script
    sbStartupScript.AppendLine("\r\n\r");
    sbStartupScript.AppendLine("$('form').validate({");
    sbStartupScript.AppendLine("errorPlacement: $.datepick.errorPlacement,");
    sbStartupScript.AppendLine("rules: {");
    sbStartupScript.AppendLine(this.DateControlClientId + ": {");//start of format picker
    sbStartupScript.AppendLine("required: true, dpDate: true}");//end of formate picker
    sbStartupScript.AppendLine("}, ");// end of rules
    sbStartupScript.AppendLine("messages: {");
    sbStartupScript.AppendLine(this.DateControlClientId + ": 'Please enter a valid date (" + this.DateTimeFormat + ")'");
    sbStartupScript.AppendLine("}");// end of messages
    sbStartupScript.AppendLine("});"); //end of validate function
    //******************* close document ready function
    sbStartupScript.AppendLine("} );");
    return sbStartupScript.ToString();
    /// <summary>
    /// Fill day month and year dropdown
    /// </summary>
    private void FillDropdowns()
    //Fill Day Dropdown
    ListItem liDay = new ListItem("Day", "0");
    ddlDay.Items.Add(liDay);
    for (int i = 1; i <= 31; i++)
    ListItem li = new ListItem(i.ToString(), i.ToString());
    ddlDay.Items.Add(li);
    //Fill Month Dropdown
    ListItem liMonth = new ListItem("Month", "0");
    ddlMonth.Items.Add(liMonth);
    string monthName = string.Empty;
    for (int i = 1; i <= 12; i++)
    switch (DisplayMonthType)
    case DisplayMonthTypes.Full:
    monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(i);
    break;
    case DisplayMonthTypes.Short:
    monthName = CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(i);
    break;
    ListItem li = new ListItem(monthName, i.ToString());
    ddlMonth.Items.Add(li);
    //Fill Year Dropdown
    ListItem liYear = new ListItem("Year", "0");
    ddlYear.Items.Add(liYear);
    string yearDisplay = string.Empty;
    for (int i = MinYear; i <= MaxYear; i++)
    switch (DisplayYearType)
    case DisplayYearTypes.Full:
    yearDisplay = i.ToString();
    break;
    case DisplayYearTypes.Short:
    yearDisplay = i.ToString().Substring(2);
    break;
    ListItem li = new ListItem(yearDisplay, i.ToString());
    ddlYear.Items.Add(li);
    setDropDownValue(this.SelectedValue);
    private void generateDisplayMessage()
    if (this.DisplayMessageLable)
    if (this.DisplayControl == DisplayControls.TextBox)
    lblMsg.Text = this.DateTimeFormat;
    if (this.MinDate != null && this.MinDate.Value != new DateTime())
    lblMsg.Text += " From " + this.MinDate.Value.ToString(this.DateTimeFormat);
    if (this.MaxDate != null && this.MaxDate.Value != new DateTime())
    lblMsg.Text += " To " + this.MaxDate.Value.ToString(this.DateTimeFormat);
    private void setDropDownValue(DateTime? dt)
    if (ddlDay.Items.Count != 0 && ddlMonth.Items.Count != 0 && ddlYear.Items.Count != 0)
    if (dt != null && dt != new DateTime())
    ddlDay.SelectedValue = ddlDay.Items.FindByValue(dt.Value.Day.ToString()).Value;
    ddlMonth.SelectedValue = ddlMonth.Items.FindByValue(dt.Value.Month.ToString()).Value;
    ddlYear.SelectedValue = ddlYear.Items.FindByValue(dt.Value.Year.ToString()).Value;
    else
    ddlDay.SelectedValue = "0";
    ddlMonth.SelectedValue = "0";
    ddlYear.SelectedValue = "0";
    #endregion
    }Usage Of Code in .ascx<cc2:DateTimePicker ID="dtpDOB" DisplayType="Date" DisplayMode="ImageButton" ButtonImage="../Images/calendar.png" runat="server"Changing Value from .cs file dtpDOB.SelectedValue = DateTime.Parse("01/01/2001");It is not reflected in screen

    Hello,
    According to your code, it's an ASP.NET user control problem. Please post in
    ASP.NET forums where more web developers will give you help.
    Thanks for your understanding.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Search Text in a TextBox using IndexOf

    Rather than using Regular Expression I want to know how I can use LastIndexOf and IndexOf to search for the Next and Previous match of a word typed. I want to use a TextBox and not a RichTextBox. Can someone provide me with a way to do this using loop so
    it gets all the matches. I've got this so far:
    Public Function FindAndSelect(TextToFind As String, MatchCase As Boolean) As Boolean
    Dim mode = If(MatchCase, StringComparison.CurrentCulture, StringComparison.CurrentCultureIgnoreCase)
    Dim position As Integer = textBox1.Text.IndexOf(TextToFind, mode)
    If position = -1 Then
    Return False
    End If
    textBox1.SelectionStart = position
    textBox1.SelectionLength = TextToFind.Length
    TextBox1.Select()
    Return True
    End Function
    MessageBox.Show("Hey You!")

    Rather than using Regular Expression I want to know how I can use LastIndexOf and IndexOf to search for the Next and Previous match of a word typed. I want to use a TextBox and not a RichTextBox. Can someone provide me with a way to do this using loop so
    it gets all the matches. I've got this so far:
    Public Function FindAndSelect(TextToFind As String, MatchCase As Boolean) As Boolean
    Dim mode = If(MatchCase, StringComparison.CurrentCulture, StringComparison.CurrentCultureIgnoreCase)
    Dim position As Integer = textBox1.Text.IndexOf(TextToFind, mode)
    If position = -1 Then
    Return False
    End If
    textBox1.SelectionStart = position
    textBox1.SelectionLength = TextToFind.Length
    TextBox1.Select()
    Return True
    End Function
    MessageBox.Show("Hey You!")
    Hello,
    For Next, we could get that done with following way since we could select start index, you could refer to
    String.IndexOf Method (String, Int32, StringComparison).
    Dim startPostion As Integer = 0
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim str As String = "1"
    ' Dim mode = If(StringComparison.CurrentCulture, StringComparison.CurrentCultureIgnoreCase)
    If startPostion + str.Length > TextBox1.Text.Count Then
    Return
    End If
    Dim position As Integer = TextBox1.Text.IndexOf("1", startPostion, StringComparison.CurrentCultureIgnoreCase)
    If position = -1 Then
    Return
    End If
    TextBox1.SelectionStart = position
    TextBox1.SelectionLength = str.Length
    startPostion = position + str.Length
    TextBox1.Select()
    End Sub
    The part about previous is quite similar, you could edit it to suit your scenario.
    Regards,
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How do I highlight text in a textbox?

    I am trying to use a find function that will search through raw data and highlight a match to a search string. Is there a way in which I can do this or do I need to setup a table and use cells?

    It depends on what you want to do when you say highlight. You can select any substring from a textbox programmatically with SetCtrlAttribute setting the TextSelectionStart and TextSelectionLength properties. Remember to make the text box the active control though with SetActiveCtrl in order to see the selection. You cannot highlight by color though.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • Cant insert Text into a TextBox. (Confusing Problem, CS6)

    Hello forum members!
    Just got the trial today and I am trying to insert text into a document. I press "T" and drag a box for a textbox. I then double-click inside that box to type something, and whatever I type absolutely NOTHING appears. It just blinks and nothing is actually typed inside the box.
    This is really frustrating. I have only just started and have one document that is fresh, so my question is what is the problem here?
    Thanks in advance,
    Shane Stocks

    Could you elaborate on that a little? I have taken a screenshot of my screen to show you how everything is. I have not touched any settings and have literally downloaded the trial about an hour ago.
    I do this. Click on the T, drag a box, then start typing. When I type, the icon does not move, and for some reason it seems what I am typing renames the layer tab. Please view the image, everything is there.
    Thanks again,
    P.S. The text-box does dissapear when the icon changes into a text icon, and the image above is me typing random things. Nothing appears.

  • Visio: Can't get Text Data in "Textboxes" to Export Properly using Reports or Databased Export Wizard

    Clarification: by textbox -- I mean a "text" shape created by using the "A Text" tool that appears in the ribbon. They are just free text boxes that are not associated w/
    any other shape.
    Hi. I am using Visio Professional 2010.  I am interested in extracting from each of my visio diagrams/drawings the text information that is shown in textboxes.
    I've tried using the Database Export Wizard and the Reports add-on; neither work. I've tried exporting to Excel and to Access.
    What I end up w/ is for some textboxes, the contained text is exported. But for other textboxes, nothing is exported or in some cases just a single letter/character is exported. I checked the number of characters in each textbox and all but one have fewer
    than 255 characters -- (if that makes a difference??). Some textboxes contain newline character (i.e., carriage returns). Does that make a difference?
    I've looked at previous questions and answers on the web and on this forum re. this topic and followed the proscribed advice, w/ no success. So any additional advice anyone can provide me, I would greatly appreciate it.
    Thanks -
    CJA

    Hey Chris,
    I tried exporting the text in visio drawing using database export wizard and found that yes the text which is associated with the sub group doesn't get exported.
    So the solution I think would work is that we have to write a macro which would read the shape.text property and it should check that if the shape is a group shape then it would check the sub shapes to get the text associated with them.
    You can refer to following msdn page to write this macro,
    msdn.microsoft.com/en-us/library/office/ff766497(v=office.15).aspx
    Let me know if you need further help to resolve your issue or if I have missed something.

  • Ticking a checkbox puts text into a textbox

    Hi guys,
    I am struggling to find an example of code for the really simply scenario of, a checkbox (Checkbox1) is ticked and pre-fills a textbox (Textbox1) with "Blah blah blah".
    When the checkbox is unticked, the text vanishes.
    Can anyone help me?

    Thanks for answering this question as i was looking for something similar. Could this be modified to fill multiple boxes? The following was tried without success.  Without the second line added it works perfect. 
    if (event.target.value!="Off") {  //If checkbox is ticked
    this.getField("Textbox1").value = "Blah blah blah";
    this.getField("Textbox2").value = "BooYaa";
    else
    this.getField("Textbox1").value = "";
    this.getField("Textbox2").value = "";
      //Clear the text field if checkbox is not ticked

  • Acrobat pro 9 - How do I reference the text in another textbox on another page?

    Near the top of each page on my form I have a text box that users are to enter their company name.  Unfortunately, there is the same information requested on each page in the form.  It is too far down to use a header, but I don't think you can place a field in the header.
    I know that you can use the Calculate tab to reference the numeric values of other fields, for mathematical purposes.  What I would like to do is: Have the other company name fields in the rest of document reference the first one so the user only has to enter it once.
    I have been searching and googling without success, and I even checked the manual but found no reference in the logical areas.  Can this be done with Acrobat Pro 9?
    Thanks in advance for your help.
    Gregory

    Huh.  Whaddya know, it does.  Such an easy solution.  And it is probably documented somewhere.  I guess I should have done more than skim through the manual.  Thanks Gilad.

  • Tagging certain text in a textbox

    Hello,
    I am using Indesign with some scripting to build catalogue pages on the fly.  I've got it working really well, but another question has arisen and I'm not sure how to answer it.
    Each product has a single image and a single text frame describing the product. The text frame has many pieces of information about the product including a description, physical size and pricing information.  I have been asked to code the system so that the price information can be updated if price changes after the catalogue is produced, but before it is printed.  I have a script label on the text frame so I can update all the text in the frame, but sometimes there are manual changes made in Indesign that would be disrupted if I re-insert all the information in the text frame.
    Is there a way to "tag" a certain piece of data in the text frame so that I can update it later without disturbing the rest of the contents of that text frame?
    Almost like an XML markup of some sort so that I can locate just the price.  I have asked if we can put the price in its own text frame but there are other formatting issues that arise when we use more than one text frame for the description.
    Thanks,
    Dave

    Thanks for the relplies.  We're using CS3 so I've explained to them that we can't do it with the current version.
    Thanks again.
    Dave

Maybe you are looking for

  • Connecting Power Query to SharePoint Foundation 2010

    I'm looking to set up PowerQuery in Excel 2013 to link into the various lists on our SharePoint 2010 Foundation server. I have established the connection URL. The SharePoint Foundation 2010 server is on the same LAN I'm connected to, so I've opted fo

  • WHEN RYING TO OPEN GETTING MESSAGE PLATFORM VERSION 8.0, MIN VERSION 7D MAX VERSION 7D

    ''duplicate of https://support.mozilla.com/en-US/questions/903944'' WHEN I TRY TO OPEN FIREFOX AS AN INTERNET BROWSER I GET A MESSAGE PLATOFORM VERSION 8.0 NO COMPATIBABLEW WITH MIN VERSION 7.D MAX VERSION 7.D

  • LCM Migration No Longer Working

    LCM migrations(Hyperion v11.1.2) are getting "stuck" at the point where Migration Status Report shows "Status = In Progress" but they do not complete. This used to work but no longer works. No known changes to the environment or setup 1) Have tried r

  • Can`t open vision builder 2011

    I have some problem about vision builder AI 2011 please help me!!! Log: #OSName: Microsoft Windows XP Service Pack 3 #OSVers: 5.1 #OSBuild: 2600 #AppName: Vision Builder #Version: 10.0.1f3 32-bit #AppKind: AppLib #AppModDate: 07/30/2011 12:04 GMT #La

  • QLLC to LAN convertion

    Hello Forum we are trying to establish a connection between 2 PUs and the M/F. The two PUs are actually two controllers inside an IBM 400. The IBM 400 is connected to a cisco with an x25 line. The M/F is connected to the ethernet side of the cisco. S