Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. I can't get my codebehind to work

I can't get my codebehind to work

Scheduled Pinned Locked Moved C#
csharpdesigndebugging
4 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bigtone78
    wrote on last edited by
    #1

    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" %>

    D 1 Reply Last reply
    0
    • B bigtone78

      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" %>

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • D Dave Kreskowiak

        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

        B Offline
        B Offline
        bigtone78
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • B bigtone78

          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

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups