Trouble displaying Data Grid control
Hi,
I have been trying to display some data in a datagrid control .All the other controls in the form are displayed but not DataGrid Control and also the Page load event is not firing.When I run the following code,I get the button and textbox displayed and nothing else.
<%@ import Namespace="System.Data.SqlClient" %>
<%@import Namespace="System.Data"%>
<%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="aspdotnet.WebForm2"%>
<script Runat="server">
void Page_Load(Object sender,EventArgs e)
{
Response.Write("In");
SqlConnection myconn =new SqlConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=PRIYA;Data Source=ROC06650");
SqlDataAdapter mycomm=new SqlDataAdapter("select * from baby",myconn);
DataSet ds=new DataSet();
mycomm.Fill(ds);
DataGrid1.DataSource=ds;
DataGrid1.DataBind();
Response.Write("connected");
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm2</title>
<meta name="GENERATOR" Content="Microsoft Visual
Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:DataGrid ID="DataGrid1"
Runat="server"></asp:DataGrid>
<asp:Button ID="button1"
Runat="server"></asp:Button>
<asp:TextBox ID="text1"
Runat="server"></asp:TextBox>
</form>
</body>
</HTML>
Any help would be appreciated.Thanks.
|