小山

付出最大努力,追求最高成就,享受最佳生活,收获无悔人生

博客园 首页 新随笔 联系 订阅 管理


1.html
<HTML>
    
<HEAD>
        
<title>Weather</title>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form id="Form1" method="post" runat="server">
            
<TABLE id="Table1" style="Z-INDEX: 110; LEFT: 296px; WIDTH: 320px; POSITION: absolute; TOP: 24px; HEIGHT: 231px"
                cellSpacing
="1" cellPadding="1" width="320" bgColor="#ffff99" border="1">
                
<TR>
                    
<TD><asp:label id="Label1" runat="server" Font-Italic="True">==天气预报==</asp:label></TD>
                    
<TD><asp:dropdownlist id="ddlcity" runat="server">
                            
<asp:ListItem Value="深圳" Selected="True">深圳</asp:ListItem>
                            
<asp:ListItem Value="广州">广州</asp:ListItem>
                            
<asp:ListItem Value="上海">上海</asp:ListItem>
                            
<asp:ListItem Value="北京">北京</asp:ListItem>
                            
<asp:ListItem Value="天津">天津</asp:ListItem>
                            
<asp:ListItem Value="武汉">武汉</asp:ListItem>
                            
<asp:ListItem Value="重庆">重庆</asp:ListItem>
                            
<asp:ListItem Value="成都">成都</asp:ListItem>
                            
<asp:ListItem Value="南京">南京</asp:ListItem>
                            
<asp:ListItem Value="香港">香港</asp:ListItem>
                            
<asp:ListItem Value="澳门">澳门</asp:ListItem>
                        
</asp:dropdownlist></TD>
                    
<TD><asp:button id="Button1" runat="server" Text="读取"></asp:button></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_city" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_wea" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_sky" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_date" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_w1" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_w2" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_w3" runat="server"></asp:label></TD>
                
</TR>
                
<TR>
                    
<TD colSpan="3"><asp:label id="l_w4" runat="server"></asp:label></TD>
                
</TR>
            
</TABLE>
        
</form>
    
</body>
</HTML>
2.cs
添加如下应用
using System.Net;
using System.IO;
页面代码
public class Weather : System.Web.UI.Page
    
{
        
protected System.Web.UI.WebControls.Label l_date;
        
protected System.Web.UI.WebControls.Label l_city;
        
protected System.Web.UI.WebControls.Label l_wea;
        
protected System.Web.UI.WebControls.Label l_sky;
        
protected System.Web.UI.WebControls.Label l_w1;
        
protected System.Web.UI.WebControls.Label l_w2;
        
protected System.Web.UI.WebControls.Button Button1;
        
protected System.Web.UI.WebControls.Label Label1;
        
protected System.Web.UI.WebControls.Label l_w3;
        
protected System.Web.UI.WebControls.Label l_w4;
        
protected System.Web.UI.WebControls.DropDownList ddlcity;
    
        
private void Page_Load(object sender, System.EventArgs e)
        
{
            
if (!Page.IsPostBack)
            
{
                writeWeatherInfo(ddlcity.SelectedValue);
                writeWeather(ddlcity.SelectedValue);
            }

        }
    

        
getWeatherByCity 通过城市过虑

        
writeWeatherInfo 显示处理后的信息

        
writeWeather 直接显示读取到的信息
    
        
Button1_Click

        
Web Form Designer generated code

        
    }
3.源代码下载/Files/singlepine/Weather.rar
posted on 2005-12-07 18:25  小山  阅读(9379)  评论(8编辑  收藏  举报