473,388 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Parent DataList!

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
Nov 20 '05 #1
1 1457
Adam is this what you are looking for ?:-
CStr(ParentList.DataKeys(ParentList.SelectedIndex) ).Replace("'", "''")
Hope that helps
Patrick

"Adam Knight" <ad**@pertrain.com.au> wrote in message
news:#5**************@TK2MSFTNGP09.phx.gbl...
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

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mary Kerrigan | last post by:
I have a user control (menu) with a data list: <asp:DataList id="MyList" runat="server"> <ItemTemplate> <asp:hyperlink cssclass="MenuUnselected" id="myLink1" Text='<%#...
0
by: Homa | last post by:
Hi, I have a nested DataList, say a datalist of customer (outer) and order (inner). for the inner DataList, I want to get the idCustomer in DataBinding time. How to I access to this...
0
by: Moojjoo | last post by:
OK fellow developers... I am running into a new problem. I have developed a datalist Inside the datalist I have a label What I want to do is set the label value using a class I developed. ...
0
by: Adam Knight | last post by:
Hi all, I have the following code: <asp:DataList ID="dlDocumentTypes" width="100%" Height="100%" Runat="server"> <ItemTemplate> <table height="100%" width="100%" border="0" cellspacing="0"...
1
by: schapopa | last post by:
Hi, I have nested datalist and I have some events that work, but I cannot find out how to refresh child and parent datalist after executing events on the child datalist. My childdatalist is an...
3
by: mroffey | last post by:
Hi everyone, I've been having this problem and I've searched high and low, but I can't seem to find the answer to what is probably a very simple solution. In a nutshell, I have a nested...
0
by: CMELLO | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After...
0
by: =?Utf-8?B?Y2luZHk=?= | last post by:
I have am dynamically loading a web user control based on the click of a tab strip I load the default control for the first tab in the page load event after checking page is not postback. After...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.