Sponsored Ad

Saturday, September 26, 2009

C# Text Box

To affectation assorted types of formatted text, use the RichTextBox control.The argument displayed by the ascendancy is independent in the Argument property. By default, you can access up to 2048 characters in a argument box. If you set the MultiLine acreage to true, you can access up to 32 KB of text.
The code below sets text in the control at run time.

<%Page Language="c#" %>
<script runat="server">
    void Page_Load()
    {
      if (Page.IsPostBack)
      {
          lblName.Text = “”;
          lblAddress.Text = “”;
          lblPassword.Text = “”;
      }
      if (txtName.Text !="")
        lblName.Text = "You have entered the following name: " +  txtName.Text;
      if (txtAddress.Text !="")
        lblAddress.Text = "You have entered the following address: " + txtAddress.Text;
      if (txtPassword.Text !="")
        lblPassword.Text = "You have entered the following password: " + txtPassword.Text;
    }
</script>
<html>
<head>
    <title>Text Box Example</title>
</head>
<body>
    <asp:Label id="lblName" runat="server"></asp:Label>
    <br />
    <asp:Label id="lblAddress" runat="server"></asp:Label>
    <br />
    <asp:Label id="lblPassword" runat="server"></asp:Label>
    <br />
    <form runat="server">
        Please enter your name:
        <asp:textbox id="txtName" runat="server"></asp:textbox>
        <br />
        <br />
        Please enter your address:
        <asp:textbox id="txtAddress" runat="server" textmode="multiline" rows="5"></asp:textbox>
        <br />
        <br />
        Please enter your password:
        <asp:textbox id="txtPassword" runat="server" textmode="password"></asp:textbox>
        <br />
        <br />
        <input type="submit" value="Submit Query" />
    </form>
</body>
</html>

0 comments:

Post a Comment

Sponsored Ad

Website Update

Followers