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

J

Joey

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top