I can't get my codebehind to work
-
I can't get my codebehind to work. Here is the code behind code: namespace nestedRepeaters { using System.Data; using System.Data.Odbc; public class nestedRepeater : System.Web.UI.Page { public System.Web.UI.WebControls.Repeater parentRepeater; static void Main() { } public void Page_Load(object sender, System.EventArgs e) { //Create the connection and DataAdapter for the Authors table. string sConnString = "Dsn=mysqldb;Uid=bigtone78 ; Pwd="; OdbcConnection cnn = new OdbcConnection(sConnString); OdbcDataAdapter cmd1 = new OdbcDataAdapter("select * from questions",cnn); //Create and fill the DataSet. DataSet ds = new DataSet(); cmd1.Fill(ds,"questions"); //Insert code in step 4 of the next section here. //Bind the Authors table to the parent Repeater control, and call DataBind. parentRepeater.DataSource = ds.Tables["questions"]; Page.DataBind(); //Close the connection. cnn.Close(); } } } and here is where I call it in the aspx file: <%@ Page language="c#" Codebehind="test1.aspx.cs" Debug="true" AutoEventWireup="false" Inherits="nestedRepeaters.nestedRepeater" %>
-
I can't get my codebehind to work. Here is the code behind code: namespace nestedRepeaters { using System.Data; using System.Data.Odbc; public class nestedRepeater : System.Web.UI.Page { public System.Web.UI.WebControls.Repeater parentRepeater; static void Main() { } public void Page_Load(object sender, System.EventArgs e) { //Create the connection and DataAdapter for the Authors table. string sConnString = "Dsn=mysqldb;Uid=bigtone78 ; Pwd="; OdbcConnection cnn = new OdbcConnection(sConnString); OdbcDataAdapter cmd1 = new OdbcDataAdapter("select * from questions",cnn); //Create and fill the DataSet. DataSet ds = new DataSet(); cmd1.Fill(ds,"questions"); //Insert code in step 4 of the next section here. //Bind the Authors table to the parent Repeater control, and call DataBind. parentRepeater.DataSource = ds.Tables["questions"]; Page.DataBind(); //Close the connection. cnn.Close(); } } } and here is where I call it in the aspx file: <%@ Page language="c#" Codebehind="test1.aspx.cs" Debug="true" AutoEventWireup="false" Inherits="nestedRepeaters.nestedRepeater" %>
ANd what do you mean by "can't get it to work"? Can't get what to work? Does the Page_Load event code execute? Does the database code execute? EXACTLY, what doesn't work and what does? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
ANd what do you mean by "can't get it to work"? Can't get what to work? Does the Page_Load event code execute? Does the database code execute? EXACTLY, what doesn't work and what does? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Nothing works I get a blank screen...... I think maybe its the main function. I dont think i need one but if i dont use one the code doesnt compile
bigtone78 wrote: Nothing works I get a blank screen...... What have you got on your ASPX page?
Do you want to know more? WDevs.com - Member's Software Directories, Blogs, FTP, Mail and Forums