Intersoft Support Center

Get and Set Input Value in Server

You can get and set value for WebInput from code behind.

In this topic, you will learn how to set different initial value WebInput.

To set simple input initial value

  1. Drag WebInput instance to WebForm.
  2. In Page_Load event handler function, put the following code:
  3. C# Copy ImageCopy Code
    protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
          wiSimpleInput.Value="simple alphanumeric text for webinput 1234567890";
       }
    }
    

To set DateTimeFree input initial value

  1. Drag WebInput instance to WebForm.
  2. In Page_Load event handler function, put the following code:
  3. C# Copy ImageCopy Code
    protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
          wiDateTimeFreeInput.Value = new DateTime(2007, 1, 1);
       }
    }
    

To set DateTimeMasked input initial value

  1. Drag WebInput instance to WebForm.
  2. In Page_Load event handler function, put the following code:
  3. C# Copy ImageCopy Code
    protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
          wiDateTimeMaskedInput.Value = new DateTime(2007, 1, 31);
       }
    }
    

To set Number input initial value

  1. Drag WebInput instance to WebForm.
  2. In Page_Load event handler function, put the following code:
    C# Copy ImageCopy Code
    protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
          wiNumberInput.Value = 12345;
       }
    }
    

To set DynamicCurrency input initial value

  1. Drag WebInput instance to WebForm.
  2. In Page_Load event handler function, put the following code:
    C# Copy ImageCopy Code
    protected void Page_Load(object sender, EventArgs e)
    {
       if (!IsPostBack)
       {
          decimal currencyValue = 1000000000000000000000m;
          wiDynamicCurrencyInput.Value = currencyValue;
       }
    }
    

To get value from server-side

  1. Drag WebInput, ASP.NET button and label instance to WebForm.
  2. In Button_Click event, put the following code:
    C# Copy ImageCopy Code
    protected void Button1_Click(object sender, EventArgs e)
    {
       lblSimpleInput.Text = "postback value : " + wiSimpleInput.Text;
    }
    
Previous Next