TextBox, TextMode: values SingleLine for SingleLine of text, MultiLine for multiple lines of text, and so on.

DropDownList control, single button control Radio, CheckBox control, etc

Use a textbox implementation to illustrate these controls.


Create a new website ——>

Choose C#,ASP.NET empty site

Add —-> New Add a new item

Select Web Form

Expand related files

Toolbox, with server controls, click on TextBox

Edit the properties of TextBox1

Add the CheckBox control

Set the name of the CheckBox


Text box selection: <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Text=" bold "/> <asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True" Text=" italic "/> <asp:CheckBox ID="CheckBox3" runat="server" AutoPostBack="True" Text=" underline" />Copy the code

12 asp:ListItem16 asp:ListItem25 Asp :ListItem30 asp:ListItem36





</div>
</form>
Copy the code
This is the code for C#
```C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;

public partial class days_20171107 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CheckBox1.Checked)
            TextBox1.Font.Bold = true;
        else
            TextBox1.Font.Bold = false;

        TextBox1.Font.Italic = CheckBox2.Checked;
        TextBox1.Font.Underline = CheckBox3.Checked;
        TextBox1.Font.Size = int.Parse(DropDownList1.Text);

        if (Red.Checked)
            TextBox1.ForeColor = Color.Red;
        else if (Green.Checked)
            TextBox1.ForeColor = Color.Green;
        else if (Yellow.Checked)
            TextBox1.ForeColor = Color.Yellow;
       elseTextBox1.ForeColor = Color.Blue; }}Copy the code

The result is as follows:


C# syntax needs further development, JSP and asp, really…

### Code baidu Cloud