.net的相加,显示星期,大小写转换! 不指定

Else , 2007/10/03 23:01 , 代码片段,演示也有 , Comments(1) , Reads(2733) , Via Original
最近去福州书店买了一本28元的.net的书,感觉还不错,是那种学校上课的书!
于是按里面的要求实验了一下!感觉还不错!

文件名d2.aspx代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="d2.aspx.cs" Inherits="d2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>小写字母转换成大写字母</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <span style="color: #ff3333">把小写字母转换成大写字母</span><br />
        <br />
        请输入小写字母 :<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="bt1" runat="server" OnClick="Text_Chang" Text="转换为大写" />
        <br />
        <br />
        转换后的大写字母 :<asp:Label ID="Lable1" runat="server"></asp:Label>
        <br />
        <br />
        ---------------------------------------------------------<br />
        <span style="color: #ff3300">两个数求和:<br />
            <br />
        </span>
        请输入第一个数:<asp:TextBox ID="TextBox2" runat="server" Width="50px"></asp:TextBox><br />
        <br />
        请输入第二个数:<asp:TextBox ID="TextBox3" runat="server" Width="54px"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClick="He_Click" Text="求和" /><br />
        <br />
        两数之和为:<asp:Label ID="he" runat="server"></asp:Label><br />
        <br />
        ----------------------------------------------------------<br />
        <span style="color: #ff3333">显示日期,时间,星期</span><br />
        <br />
        今天是:<asp:Label ID="Date_str" runat="server" Text="Label" Width="199px"></asp:Label><br />
        <br />
        时间是:<asp:Label ID="Time_str" runat="server" Text="Label" Width="199px"></asp:Label><br />
        <br />
        星期是:<asp:Label ID="Week_str" runat="server" Text="Label" Width="194px"></asp:Label></div>
    </form>
</body>
</html>


d2.aspx.cs的代码如下

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class d2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //显示日期
        Date_str.Text = DateTime.Now.ToLongDateString();
        //显示时间
        Time_str.Text = DateTime.Now.ToLongTimeString();
        //用中文支持
        Week_str.Text = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);

    }

    protected void Text_Chang(object sender,EventArgs e)
    {
        //把小写字母转换成大写
        Lable1.Text=TextBox1.Text.ToUpper();
    }


   //求和
    protected void He_Click(object sender,EventArgs e)
    {
        //转换数据
        int int1 = Convert.ToInt32 (TextBox2.Text);
        int int2 = Convert.ToInt32 (TextBox3.Text);
        //转换数据类型
        he.Text = Convert.ToString(int1 + int2);
    }


}

wxxslt
2007/10/04 19:40
crycrycry
Pages: 1/1 First page 1 Final page
Add a comment

Nickname

Site URI

Email

Enable HTML Enable UBB Enable Emots Hidden Remember [Login] [Register]