J
John Spiegel
Hi All,
I've got the following .aspx file with the then following .cs code. The
page renders fine on first run, but once I click the submit, it just comes
back with a cannot be displayed page indicating that the page is not
available. Anyone see what probably obvious or stupid thing I'm missing?
TIA,
John
Test.aspx:
========
<%@ Page Language="C#" Src="Temp.cs" Inherits="dgrdAccountSort" %>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:datagrid id="grdAccount" runat="server" Height="100%"
Width="100%"></asp:datagrid>
<input type="submit" value="Submit Query" runat="server" />
</form>
</body>
</html>
Temp.cs code:
==========
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public class dgrdAccountSort : Page
{
private string SortExpression;
protected DataGrid grdAccount;
protected void Page_Load(object Src, EventArgs e)
{
BindGridReader();
}
public void BindGridReader()
{
string SelectCommand = "SELECT * FROM AcctName";
if (SortExpression != null)
SelectCommand += " ORDER BY " + SortExpression;
OleDbConnection conn = new OleDbConnection(@"Provider=vfpoledb.1;User
Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\mytesting\IntelligentOffice"
);
OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
conn.Open();
IDataReader reader = cmd.ExecuteReader();
grdAccount.DataSource = reader;
grdAccount.DataBind();
conn.Dispose();
}
}
I've got the following .aspx file with the then following .cs code. The
page renders fine on first run, but once I click the submit, it just comes
back with a cannot be displayed page indicating that the page is not
available. Anyone see what probably obvious or stupid thing I'm missing?
TIA,
John
Test.aspx:
========
<%@ Page Language="C#" Src="Temp.cs" Inherits="dgrdAccountSort" %>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:datagrid id="grdAccount" runat="server" Height="100%"
Width="100%"></asp:datagrid>
<input type="submit" value="Submit Query" runat="server" />
</form>
</body>
</html>
Temp.cs code:
==========
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public class dgrdAccountSort : Page
{
private string SortExpression;
protected DataGrid grdAccount;
protected void Page_Load(object Src, EventArgs e)
{
BindGridReader();
}
public void BindGridReader()
{
string SelectCommand = "SELECT * FROM AcctName";
if (SortExpression != null)
SelectCommand += " ORDER BY " + SortExpression;
OleDbConnection conn = new OleDbConnection(@"Provider=vfpoledb.1;User
Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\mytesting\IntelligentOffice"
);
OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
conn.Open();
IDataReader reader = cmd.ExecuteReader();
grdAccount.DataSource = reader;
grdAccount.DataBind();
conn.Dispose();
}
}