Goals:

Steps:

  1. Create a new ASP.NET Web Application project.
  2. Add necessary controls (using the Design view of the page) and set their properties.
  3. Change the look of the page by using a .css file
  4. Note that there exist special validation controls (similar to those from Windows Forms) which can be used instead of manual changing a text of the Label control. Validation controls can be found in the 'Validation' group in the Toolbox window.
  5. Understanding the postback mechanism ul>
  6. RRemove items added to the DropDownList control using Visual Designer - open the page in the Source view and remove the following code:
    <asp:ListItem>+</asp:ListItem>
    <
    asp:ListItem>-</asp:ListItem>
    <
    asp:ListItem>*</asp:ListItem>
    <
    asp:ListItem>/</asp:ListItem>
  7. Add the following code to the Page_Load method (in the Default.aspx.cs file):
    protected void Page_Load(object sender, EventArgs e)
    {
        operatorDropDownList.Items.Add(
    "+");
        operatorDropDownList.Items.Add(
    "-");
        operatorDropDownList.Items.Add(
    "/");
        operatorDropDownList.Items.Add(
    "*");
    }
  8. Compile the project and run (or just refresh the page in the browser). Note, that after making two calculations, there are 8 operators in the list - each calculation adds new 4 operators. To add operators only during the initial loading of the page, change the code to the following:
    protected void Page_Load(object sender, EventArgs e)
    {
        
    if (!IsPostBack)
        {
            operatorDropDownList.Items.Add(
    "+");
            operatorDropDownList.Items.Add(
    "-");
            operatorDropDownList.Items.Add(
    "/");
            operatorDropDownList.Items.Add(
    "*");
        }
    }
    The IsPostBack property gets a value indicating whether the page is being loaded in response to the client's postback, or if it is being loaded and accessed for the first time.
  9. Using themes.
  10. The theme used by the page can be changed programmatically in the PreInit event:

[Source code]