<%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="C#" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile"%>
<%@ Import Namespace="System.IO" %> 

<script runat="server" language="c#"> 

public void List_OnClick(Object sender, ListCommandEventArgs e) 
{ 
	String sportstr=""; 

	switch (e.ListItem.Value) { 
		case "cricket": 
			sportstr="c:/sports/cricket.txt"; 
			break; 

		case "tennis": 
			sportstr="c:/sports/tennis.txt"; 
			break; 

		case "basketball": 
			sportstr="c:/sports/basketball.txt"; 
			break; 

		case "olympics": 
			sportstr="c:/sports/olympics.txt"; 
			break; 

		case "boxing": 
			sportstr="c:/sports/boxing.txt"; 
			break; 

		case "swimming": 
			sportstr="c:/sports/swimming.txt"; 
			break; 

		case "athletics": 
			sportstr="c:/sports/athletics.txt"; 
			break; 

		default: 
			//code here
			break; 
	} 

	StreamReader reader=File.OpenText(sportstr); 
	string output=""; 
	string sportsresult=""; 

	while((output=reader.ReadLine()) !=null) 
	{ 
		sportsresult = sportsresult + output; 
	} 
	reader.Close(); 
	SportsLabel.Text = sportsresult; 
	ActiveForm = Sports; 
} 
</script> 

<mobile:Form runat="server"> 
<mobile:Label runat="server">Select a Sport</mobile:Label> 
<mobile:List runat="server" id="Sportslist" OnItemCommand="List_OnClick" > 
	<item Text="Cricket" Value="cricket" /> 
	<item Text="Tennis" Value="tennis" /> 
	<item Text="Basketball" Value="basketball" /> 
	<item Text="Winter Olympics" Value="olympics" /> 
	<item Text="Boxing" Value="boxing" /> 
	<item Text="Swimming" Value="swimming" /> 
	<item Text="Athletics" Value="athletics" /> 
</mobile:List> 
</mobile:Form> 

<mobile:Form id="Sports" runat = "server"> 
<mobile:Label runat="server" id="SportsLabel"/> 
</mobile:Form> 



