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. Visual Basic
  4. nested repeaters in vb.net

nested repeaters in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharpdesigndockerquestion
5 Posts 2 Posters 0 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

    Hi, I've been tring to get nested repeaters to work in vb.net for a while now and I can't seem to do it. The data doesnt want to bind to the second repeater, or atleast it does bind but doesnt display. Here is the code that im using: <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data" %> sub Page_Load Dim sConnString As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection As New OdbcConnection(sConnString) Dim myInsertQuery As String = "SELECT * FROM questions" Dim myOdbcCommand As New OdbcCommand(myInsertQuery) myOdbcCommand.Connection = oODBCConnection oODBCConnection.Open() questions.DataSource= myOdbcCommand.ExecuteReader() questions.DataBind() myOdbcCommand.Connection.Close() oODBCConnection.Close() end sub sub questions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles questions.ItemDataBound if e.item.itemtype = ListItemType.Item or e.item.ItemType = ListItemType.AlternatingItem then Dim sConnString2 As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection2 As New OdbcConnection(sConnString2) Dim SQLstring2 As String = "Select * from options" Dim myOdbcCommand2 As New OdbcCommand(SQLstring2) myOdbcCommand2.Connection = oODBCConnection2 oODBCConnection2.Open() Dim myReader As OdbcDataReader = myOdbcCommand2.ExecuteReader() Dim nestedRepeater as Repeater = e.item.FindControl("opts") if (Not nestedrepeater Is Nothing) then nestedRepeater.DataSource = myReader nestedRepeater.DataBind() end if myOdbcCommand2.Connection.Close() oODBCConnection2.Close() end if end sub

    id

    question

    <%#Container.DataItem("id")%>

    <%#Container.DataItem("question")%>

    <%#Container.DataItem("opt")%>

    B D 2 Replies Last reply
    0
    • B bigtone78

      Hi, I've been tring to get nested repeaters to work in vb.net for a while now and I can't seem to do it. The data doesnt want to bind to the second repeater, or atleast it does bind but doesnt display. Here is the code that im using: <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data" %> sub Page_Load Dim sConnString As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection As New OdbcConnection(sConnString) Dim myInsertQuery As String = "SELECT * FROM questions" Dim myOdbcCommand As New OdbcCommand(myInsertQuery) myOdbcCommand.Connection = oODBCConnection oODBCConnection.Open() questions.DataSource= myOdbcCommand.ExecuteReader() questions.DataBind() myOdbcCommand.Connection.Close() oODBCConnection.Close() end sub sub questions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles questions.ItemDataBound if e.item.itemtype = ListItemType.Item or e.item.ItemType = ListItemType.AlternatingItem then Dim sConnString2 As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection2 As New OdbcConnection(sConnString2) Dim SQLstring2 As String = "Select * from options" Dim myOdbcCommand2 As New OdbcCommand(SQLstring2) myOdbcCommand2.Connection = oODBCConnection2 oODBCConnection2.Open() Dim myReader As OdbcDataReader = myOdbcCommand2.ExecuteReader() Dim nestedRepeater as Repeater = e.item.FindControl("opts") if (Not nestedrepeater Is Nothing) then nestedRepeater.DataSource = myReader nestedRepeater.DataBind() end if myOdbcCommand2.Connection.Close() oODBCConnection2.Close() end if end sub

      id

      question

      <%#Container.DataItem("id")%>

      <%#Container.DataItem("question")%>

      <%#Container.DataItem("opt")%>

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

      It seems as though the forum has made swiss cheese out of my code. It put the bottom seciton on top and took out all of my web controls....:mad: o well. I hope you can understand it anyway.

      1 Reply Last reply
      0
      • B bigtone78

        Hi, I've been tring to get nested repeaters to work in vb.net for a while now and I can't seem to do it. The data doesnt want to bind to the second repeater, or atleast it does bind but doesnt display. Here is the code that im using: <%@ Import Namespace="System.Data.Odbc" %> <%@ Import Namespace="System.Data" %> sub Page_Load Dim sConnString As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection As New OdbcConnection(sConnString) Dim myInsertQuery As String = "SELECT * FROM questions" Dim myOdbcCommand As New OdbcCommand(myInsertQuery) myOdbcCommand.Connection = oODBCConnection oODBCConnection.Open() questions.DataSource= myOdbcCommand.ExecuteReader() questions.DataBind() myOdbcCommand.Connection.Close() oODBCConnection.Close() end sub sub questions_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles questions.ItemDataBound if e.item.itemtype = ListItemType.Item or e.item.ItemType = ListItemType.AlternatingItem then Dim sConnString2 As String = "Dsn=mysqldb;" & _ "Uid=bigtone78;" & _ "Pwd=" Dim oODBCConnection2 As New OdbcConnection(sConnString2) Dim SQLstring2 As String = "Select * from options" Dim myOdbcCommand2 As New OdbcCommand(SQLstring2) myOdbcCommand2.Connection = oODBCConnection2 oODBCConnection2.Open() Dim myReader As OdbcDataReader = myOdbcCommand2.ExecuteReader() Dim nestedRepeater as Repeater = e.item.FindControl("opts") if (Not nestedrepeater Is Nothing) then nestedRepeater.DataSource = myReader nestedRepeater.DataBind() end if myOdbcCommand2.Connection.Close() oODBCConnection2.Close() end if end sub

        id

        question

        <%#Container.DataItem("id")%>

        <%#Container.DataItem("question")%>

        <%#Container.DataItem("opt")%>

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

        Your question really belongs in the ASP.NET Forum. But for an example of this, see HOW TO: Display Hierarchical Data by Using Nested Repeater Controls and Visual Basic .NET[^] on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        B 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Your question really belongs in the ASP.NET Forum. But for an example of this, see HOW TO: Display Hierarchical Data by Using Nested Repeater Controls and Visual Basic .NET[^] on MSDN. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

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

          I'm still new to this and I'm not to sure about how to use the code behind. Is there anyway to do it without using one? If there isn't how do you use one.

          D 1 Reply Last reply
          0
          • B bigtone78

            I'm still new to this and I'm not to sure about how to use the code behind. Is there anyway to do it without using one? If there isn't how do you use one.

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

            You really should pick up a book on ASP.NET. It'll clear all this up including basic concepts like code-behind. Code-behind is exactly like a Windows Form. The controls and visuals are in one file and the code that manipulates them are in another, the code-behind page. To answer your question, no, there is no way to do this without the code. There is no trick to "using" a code behind page. When you create an ASP.NET page, two files are created. One for the visuals and HTML, the .aspx file, and the code that controls them, the .aspx.vb file. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            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