Parent DataList!

A

Adam Knight

Hi all,

I have two Datalists.
One is nested within the HTML of another.

What i need to do is determine the current item index of the parent datalist
in the OnItemBound of the child.

Public Sub dlDocumentTypes_ItemBound(ByVal Sender As Object, ByVal E As
DataListItemEventArgs)

Dim cmdSelectDocuments As SqlCommand
Dim dlDocumentLinks As DataList

'determine if current item is not a header of footer
If (E.Item.ItemType <> ListItemType.Header Or E.Item.ItemType <>
ListItemType.Footer) Then

'retrieve child DataList control from item
dlDocumentLinks = CType(E.Item.FindControl("dlDocumentLinks"),
DataList)

'get documents
cmdSelectDocuments = New SqlCommand("get_documents", Cn)
cmdSelectDocuments.CommandType = CommandType.StoredProcedure
cmdSelectDocuments.Parameters.Add(New SqlParameter("@standard",
ParentList.DataKeys(ParentList.ItemIndex))) ???

'bind data list to data source
dlDocumentLinks.DataSource = Ds.Tables("DocumentTypes")
dlDocumentLinks.DataBind()

End If

End Sub

Can anyone enlighten me???

Cheers,
Adam
 
P

Patrick.O.Ige

Adam is this what you are looking for ?:-
CStr(ParentList.DataKeys(ParentList.SelectedIndex)).Replace("'", "''")
Hope that helps
Patrick
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top