Имею следующий код в файле index.aspx.cs
namespace Namespace.Index
{
/// <summary>
/// Summary description for index.aspx.
/// </summary>
public class _Index : System.Web.UI.Page
{
//private DataSet topicsDS;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
private SqlConnection sqlCon;
private SqlDataAdapter sqlCmd;
protected System.Web.UI.WebControls.DataList dls;
//private SqlCommand sqlCmd;
private void Page_Load(object sender, System.EventArgs e)
{
sqlCon=DBtools.makeConnection();
SqlDataAdapter sqlCmd = new SqlDataAdapter("SELECT " +
" * FROM Authors", sqlCon);
// Create and fill a DataSet.
DataSet ds = new DataSet();
DataGrid dg = new DataGrid();
sqlCmd.Fill(ds);
// Bind MyDataGrid to the DataSet. MyDataGrid is the ID for the
// DataGrid control in the HTML section.
DataView source = new DataView(ds.Tables[0]);
dg.DataSource = source ;
dg.DataBind();
}
//Дальше все, что обычно ставится студией 7 по умолчанию
И aspx-файл, который должен отобразить данные из таблицы
<%@ Page language="c#" Codebehind="index.aspx.cs" AutoEventWireup="false" Inherits="Namespace.Index._Index" debug="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Safed online</title>
<meta content="Microsoft Visual Studio 7.0" 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">
<ASP:DataGrid id="dg" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</form>
</body>
</HTML>
ConnectionString создается. Но Datagrid не выводится.
Что делаю не верно?