|
|
|
.
Note all possibilities of visual edition of aspx files (e.g properties,
events, the 'Tasks' window, etc.).
resultTextBox.Text = "";
double left, right;
if (!double.TryParse(leftTextBox.Text, out left)) {
statusLabel.Text = "The first number is incorrect.";
} else if (!double.TryParse(rightTextBox.Text, out right)) {
statusLabel.Text = "The second number is incorrect.";
} else if (operatorDropDownList.SelectedValue == "/" &&
right < 1e-307 && right > -1e-307)
{
statusLabel.Text = "Divide by 0";
} else {
double result = 0;
switch (operatorDropDownList.SelectedValue) {
case "+":
result = left + right;
break;
case "-":
result = left - right;
break;
case "*":
result = left * right;
break;
case "/":
result = left / right;
break;
}
resultTextBox.Text = result.ToString();
statusLabel.Text = "";
}

<link href="StyleSheet.css" rel="stylesheet" type="text/css" />

<asp:ListItem>+</asp:ListItem> <asp:ListItem>-</asp:ListItem> <asp:ListItem>*</asp:ListItem> <asp:ListItem>/</asp:ListItem>
operatorDropDownList.Items.Add("+");
operatorDropDownList.Items.Add("-");
operatorDropDownList.Items.Add("/");
operatorDropDownList.Items.Add("*");
if (!IsPostBack) {
operatorDropDownList.Items.Add("+");
operatorDropDownList.Items.Add("-");
operatorDropDownList.Items.Add("/");
operatorDropDownList.Items.Add("*");
}
<asp:TextBox runat="server" BackColor="#FFC0C0" BorderColor="Red" /> <asp:DropDownList runat="server" BackColor="#FFC0C0" ForeColor="Red" /> <asp:Button runat="server" BackColor="#FFC0C0" BorderColor="Red" ForeColor="Red" />
<configuration>
<system.web>
<pages theme="RedTheme" />
</system.web>
</configuration>
or to individual pages by settings the 'Theme' attribute of the @Page directive
<%@ Page Theme="RedTheme" %>
~/Default.aspx?theme=greenand
~/Default.aspx?theme=redrespectively. (Note the '~' sign as a path to the current Web project.)
protected void Page_PreInit(object sender, EventArgs e)
{
switch (Request.QueryString["theme"]) {
case "red":
Page.Theme = "RedTheme";
break;
case "green":
Page.Theme = "GreenTheme";
break;
}
}
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" BackColor="Maroon" Width="100%">
<table width="100%">
<tr>
<td>
<a href="http://www.mini.pw.edu.pl">
<asp:Image ID="Image1" runat="server" ImageUrl="~/mini_logo.gif" />
</a>
</td>
<td style="width: 90%">
<div style="text-align: center">
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="tahoma" ForeColor="White"
Text="My Great Web Site"></asp:Label>
</div>
</td>
<td>
<a href="http://www.pw.edu.pl">
<asp:Image ID="Image2" runat="server" ImageUrl="~/pw_logo.gif" />
</a>
</td>
</tr>
</table>
</asp:Panel>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
<asp:Panel ID="Panel2" runat="server" BackColor="Maroon" Width="100%">
<table width="100%">
<tr>
<td style="width: 100%">
<div style="text-align: center">
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Names="tahoma" ForeColor="White"
Text="Copyright © 2006"></asp:Label>
</div>
</td>
</tr>
</table>
</asp:Panel>
</div>
</form>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" MasterPageFile="~/MasterPage.master" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<asp:Label ID="Label1" runat="server" Text="The beginning of the greatest Web site."></asp:Label>
</asp:Content>


<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="default.aspx" title="Home" description="The beginning">
<siteMapNode url="about.aspx" title="About us" description="Short information about the company">
<siteMapNode url="president.aspx" title="The President" description="Our great president" />
<siteMapNode url="vicepresident.aspx" title="The Vice-President" description="Very clever vice-president" />
<siteMapNode url="keyaccountmanager.aspx" title="Key Account Managers" description="Key account managers" />
<siteMapNode url="callcenter.aspx" title="Call Center" description="Call Center Department" />
</siteMapNode>
<siteMapNode url="clients.aspx" title="Clients" description="Our clients" />
</siteMapNode>
</siteMap>

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" Trace="true"%>
protected void addButton_Click(object sender, EventArgs e)
{
if (applicationRadioButton.Checked) {
Application[keyTextBox.Text] = valueTextBox.Text;
} else if (sessionRadioButton.Checked) {
Session[keyTextBox.Text] = valueTextBox.Text;
} else if (cookieRadioButton.Checked) {
HttpCookie cookie = new HttpCookie(keyTextBox.Text, valueTextBox.Text);
Response.Cookies.Add(cookie);
}
}
protected void removeButton_Click(object sender, EventArgs e)
{
if (applicationRadioButton.Checked) {
Application.Remove(keyTextBox.Text);
} else if (sessionRadioButton.Checked) {
Session.Remove(keyTextBox.Text);
} else if (cookieRadioButton.Checked) {
Response.Cookies.Remove(keyTextBox.Text);
}
}
