....................default.aspx............................
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Get Weather By City" />
<asp:TextBox ID="txtForecast" runat="server" Height="352px"
TextMode="MultiLine" Width="448px"></asp:TextBox>
Country<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>
City<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
<asp:TextBox ID="txtCities" runat="server" Height="210px" TextMode="MultiLine"
Width="358px"></asp:TextBox>
</div>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
Text="Get Cities By City" />
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Get Weather By City" />
<asp:TextBox ID="txtForecast" runat="server" Height="352px"
TextMode="MultiLine" Width="448px"></asp:TextBox>
Country<asp:TextBox ID="txtCountry" runat="server"></asp:TextBox>
City<asp:TextBox ID="txtCity" runat="server"></asp:TextBox>
<asp:TextBox ID="txtCities" runat="server" Height="210px" TextMode="MultiLine"
Width="358px"></asp:TextBox>
</div>
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
Text="Get Cities By City" />
</form>
</body>
</html>
...........................end...................................
...........................default.aspx.cs...........................................
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
ServiceReference1.GlobalWeatherSoapClient gw = new ServiceReference1.GlobalWeatherSoapClient("GlobalWeatherSoap");
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
txtCities.Text = "";
txtForecast.Text = "";
txtForecast.Text = gw.GetWeather(txtCity.Text, txtCountry.Text);
}
catch
{
}
}
protected void Button2_Click(object sender, EventArgs e)
{
try
{
txtCities.Text = "";
txtForecast.Text = "";
txtCities.Text = gw.GetCitiesByCountry(txtCountry.Text);
}
catch
{
}
}
}
..................................end..............................
No comments:
Post a Comment