I am tying to run an application I plucked out of Jeff Prosise's book on Chapter 9;
the Congo project. When I ran it, the data grid (<asp:Button) defined below does not
show up but the button (<asp:Button) does; and even the function
"void Page_Load (Object sender, EventArgs e)" is not executed (I am in the debug mode).

Function "void OnItemCommand (Object sender, DataGridCommandEventArgs e)" is not executed either but
"void OnViewCart (Object sender, EventArgs e)" is executed in the end.

Why??? Any answers out there?

It must be obvious to you that This app is in C#.

In web.config I have:

Code:
<configuration>
	<appSettings>
		<add key="connectString"
		value="server=localhost;database=pubs;uid=sa;pwd=wango1" />
	</appSettings>
</configuration>

In Congo.cs I have some class:
Code:
public class BookOrder
{
...
...
...
}
In Congo.aspx (set as startup page, I have):


Code:
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<%@ Page CodeBehind="Congo.aspx.cs" Language="c#" AutoEventWireup="false" Inherits="WebApplication1.Congo" %>
<HTML>
	<body>
....
....
		<asp:Button Text="View Cart" OnClick="OnViewCart" RunAt="server" id="Button1" />
....
....

<asp:DataGrid ID="MyDataGrid" AutoGenerateColumns="false" CellPadding="2" BorderWidth="1" BorderColor="DeepSkyBlue" ..

...
...

</asp:DataGrid>

<script language="C#" runat="server">
	
	void Page_Load (Object sender, EventArgs e)
	{
		if (!IsPostBack) 
		{
			string ConnectString =
              		ConfigurationSettings.AppSettings["connectString"];
			SqlDataAdapter adapter = new SqlDataAdapter
             		("select * from titles where price != 0", ConnectString);
			DataSet ds = new DataSet ();
			adapter.Fill (ds);
			MyDataGrid.DataSource = ds;
			MyDataGrid.DataBind ();
		}
	}
			
	void OnItemCommand (Object sender, DataGridCommandEventArgs e)
	{
		if (e.CommandName == "AddToCart") 
		{
			BookOrder order = new BookOrder (e.Item.Cells[0].Text,
				e.Item.Cells[1].Text, Convert.ToDecimal
				(e.Item.Cells[2].Text.Substring (1)), 1);
			ShoppingCart cart = (ShoppingCart) Session["MyShoppingCart"];
			if (cart != null)
				cart.AddOrder (order);
		}
	}

	void OnViewCart (Object sender, EventArgs e)
	{
		Response.Redirect ("ViewCart.aspx");
	}

</script>
</body>
</HTML>