473,811 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ByVa l Sender As Object, ByVal E As
DataListItemEve ntArgs)

Dim cmdSelectDocume nts As SqlCommand
Dim dlDocumentLinks As DataList

'determine if current item is not a header of footer
If (E.Item.ItemTyp e <> ListItemType.He ader Or E.Item.ItemType <>
ListItemType.Fo oter) Then

'retrieve child DataList control from item
dlDocumentLinks = CType(E.Item.Fi ndControl("dlDo cumentLinks"),
DataList)

'get documents
cmdSelectDocume nts = New SqlCommand("get _documents", Cn)
cmdSelectDocume nts.CommandType = CommandType.Sto redProcedure
cmdSelectDocume nts.Parameters. Add(New SqlParameter("@ standard",
ParentList.Data Keys(ParentList .ItemIndex))) ???

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

End If

End Sub

Can anyone enlighten me???

Cheers,
Adam
Nov 20 '05 #1
1 1474
Adam is this what you are looking for ?:-
CStr(ParentList .DataKeys(Paren tList.SelectedI ndex)).Replace( "'", "''")
Hope that helps
Patrick

"Adam Knight" <ad**@pertrain. com.au> wrote in message
news:#5******** ******@TK2MSFTN GP09.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(ByVa l Sender As Object, ByVal E As
DataListItemEve ntArgs)

Dim cmdSelectDocume nts As SqlCommand
Dim dlDocumentLinks As DataList

'determine if current item is not a header of footer
If (E.Item.ItemTyp e <> ListItemType.He ader Or E.Item.ItemType <>
ListItemType.Fo oter) Then

'retrieve child DataList control from item
dlDocumentLinks = CType(E.Item.Fi ndControl("dlDo cumentLinks"),
DataList)

'get documents
cmdSelectDocume nts = New SqlCommand("get _documents", Cn)
cmdSelectDocume nts.CommandType = CommandType.Sto redProcedure
cmdSelectDocume nts.Parameters. Add(New SqlParameter("@ standard",
ParentList.Data Keys(ParentList .ItemIndex))) ???

'bind data list to data source
dlDocumentLinks .DataSource = Ds.Tables("Docu mentTypes")
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
1922
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='<%# Container.DataItem("Subject") %>' NavigateUrl='<%# "../productlist.aspx?SubjectID=" & Container.DataItem("SubjectID") & "&selection=" & Container.ItemIndex
0
1680
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 information? parent.NamingContainer? Thanks for concern, Homa Wong
0
1065
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. The only problem is I keep getting the dreaded Object reference not set to an instance of an object
0
1140
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" cellpadding="3"> <tr>
1
1963
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 user control. Thank you for your help Schapopa
3
8267
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 datalist, Parent and Child. In the child datalist, I need to get 1 of the values from the parent datalist. I've included the dataaccess code below, only for completeness.
0
2944
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 that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
0
1919
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 that the controls are loaded/unloaded based on the SelectionChanged event for the tab strip and again in Page load because with a dynamic load viewstate has to be reloaded. I have a datalist in the user control and I am trying to create the...
3
2814
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 need to control the visibility of a textbox based on a dropdown selection in the datalist's edititem template. To do this, I registered a client script block function and attached a client side handler for the dropdownlist's onchange event in the...
0
9730
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.