unable to render nested datalist when invoking the OnItemDataBound event - please help!

Discussion in 'ASP .Net Web Controls' started by Joey, Sep 23, 2004.

  1. Joey

    Joey Guest

    Hi there,

    I am trying to render a datalist inside another one when I call the
    OnItemDataBound event, I am not receiving an error, I'm just not receiving
    the datalist itself. I have checked the query and the db connection and
    ervything is working fine.

    Thanks in advance - joey



    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    Dim myconnection As New OleDb.OleDbConnection()

    myconnection = common.connDB()

    Dim strColourSql As String = "SELECT distinct style, colour FROM
    shopsales,shops where shops.shop=9 and shopsales.style='10475RIB1'"

    myconnection.Open()

    Dim myColourDataAdapter As New OleDb.OleDbDataAdapter(strColourSql,
    myconnection)

    myColourDataAdapter.Fill(ds, "shopsales")

    dtlistshops.DataSource = ds

    dtlistshops.DataBind()

    myconnection.Close()

    myColourDataAdapter.Dispose()

    myconnection.Dispose()

    End Sub

    Sub BuildSizeGrid(ByVal sender As Object, ByVal e As DataListItemEventArgs)

    If e.Item.ItemType = ListItemType.Item Or _

    e.Item.ItemType = ListItemType.AlternatingItem Then

    'Build the DataGrid

    Dim dg As New DataList()

    ' dg.rer()



    Dim drvColour As DataRowView = CType(e.Item.DataItem, DataRowView)

    Dim intColour As String

    intColour = CType(drvColour("colour"), Integer)



    Dim cnn As New OleDb.OleDbConnection()

    cnn = common.connDB()

    Dim cmd As New OleDb.OleDbCommand()

    cmd.CommandType = CommandType.Text

    cmd.CommandText = "select qoh,size from shopsales where style='10475RIB1'
    and shop=1 and colour=" & intColour & ""

    cmd.Connection = cnn

    cnn.Open()

    dg.DataSource = cmd.ExecuteReader

    dg.DataBind()



    'Add the DataGrid to the 2nd Column

    e.Item.Controls.Add(dg)

    cnn.Close()

    cmd.Dispose()

    cnn.Dispose()

    End If

    End Sub
     
    Joey, Sep 23, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. MattB

    datalist and OnItemDatabound

    MattB, Mar 28, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,997
    MattB
    Mar 29, 2005
  2. jason
    Replies:
    2
    Views:
    5,121
    jason
    Jun 14, 2005
  3. Replies:
    1
    Views:
    1,944
    Brock Allen
    Sep 29, 2005
  4. =?Utf-8?B?bWF2cmlja18xMDE=?=

    Nested Repeater - OnItemDataBound - Slow Speed

    =?Utf-8?B?bWF2cmlja18xMDE=?=, Aug 10, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    897
    sloan
    Aug 10, 2006
  5. Jeremy

    DataList OnItemDataBound

    Jeremy, Jul 9, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    215
    Jeremy
    Jul 9, 2004
Loading...

Share This Page