hello.
i am still having issues with this guy.
i suppose the question is:
how can i access the controls in the nested data list of a nested data
control?
say i have a label in the nested control.
when i try to acces it in the itemDataBound event, i get an "Object
reference not set to an instance of an object" error.
is there some way to get to the control that is nested in the
itemDataBound event?
thanks
>>> [EMAIL PROTECTED] 07/19/2004 1:45:55 PM >>>
I have a nested data list.
i would like to draw or not draw the first item in the child data
list based on the a value in the parent group.
for example:
Event 1
Current Map
Child Map
Event 2
Current Map
Child Map
Child Map
Event 3
Current Map
* if the child mapID = current mapID then don't draw that item.
in this case Event 3 only has one map and it is current. in Event 1
there are 2 maps, Event 2 has 3 maps.
as it is now, it would look something like this:
Event 1
Current Map
Child Map (duplicate of Current Map)
Child Map
Event 2
Current Map
Child Map (duplicate of Current Map)
Child Map
Child Map
Event 3
Current Map
Child Map (duplicate of Current Map)
is there some event akin to ItemDataBound that works for the Child
Items, so that i can check the items against the current ID and not
draw the one that is current again?
thanks!
Code follows:
'Page Load
Dim Cmd As New OracleDataAdapter(sSQL, oConn)
Cmd.Fill(ds, "vw_MaxInsertFiles")
Dim cmd2 As OracleDataAdapter = New
OracleDataAdapter("Select * from vw_EventFiles WHERE UPPER
(FileCategory) = 'PERIMETER MAPS' AND UPPER(EventCategoryID) = 1
ORDER BY InsertDate DESC", oConn)
cmd2.Fill(ds, "vw_EventFiles")
ds.Relations.Add("LinkRelation", ds.Tables
("vw_MaxInsertFiles").Columns("EventID"), ds.Tables
("vw_EventFiles").Columns("EventID"))
dlEventMap.DataSource = ds.Tables
("vw_MaxInsertFiles").DefaultView
dlEventMap.DataBind()
'ItemDataBound
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim lblEventTitle As Label = e.Item.FindControl("lblTitle")
Dim lblDescription As Label = e.Item.FindControl("lblEventDesc")
Dim hplImageLink As HyperLink = e.Item.FindControl("hplMapImage")
Dim hplTextLink As HyperLink = e.Item.FindControl("hplMapText")
lblEventTitle.Text = MakeOutput
(EnsureStringDefault(DataBinder.Eval(e.Item.DataItem, "EventTitle")))
lblDescription.Text = MakeOutput(EnsureStringDefault(DataBinder.Eval
(e.Item.DataItem, "EventDescription")))
hplImageLink.ImageUrl = "images/global/icon_map.gif"
hplImageLink.NavigateUrl = "Files/FileManager/" & DataBinder.Eval
(e.Item.DataItem, "FileName")
hplTextLink.NavigateUrl = "Files/FileManager/" & DataBinder.Eval
(e.Item.DataItem, "FileName")
hplTextLink.Text = "Current Map"
End If
'Data list on aspx page
<asp:DataList ID=dlEventMap
Runat=server
RepeatColumns=1
Width=100%
ItemStyle-BackColor="#FFFFFF"
CellSpacing=10
ItemStyle-CssClass="bodyheadwhite"
ItemStyle-BorderWidth=0
HeaderStyle-BorderWidth=0>
<ItemTemplate>
<tr align="left" valign="top">
<td colspan="5" class="bodyheadwhite" bgcolor="#336633">
<a name="<%# Container.DataItem("EventID") %>"></a>
<asp:Label ID=lblTitle Runat=server></asp:Label>
</td>
</tr>
<tr align="left" valign="top">
<td colspan="5" class="bodytext">
<asp:Label ID="lblEventDesc" Runat=server></asp:Label>
</td>
</tr>
<tr align="left" valign="top">
<td colspan="5" height="29">
<table width="117" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="28">
<span class="bodytext">
<asp:HyperLink ID=hplMapImage Runat=server><img
src="images/global/icon_map.gif" width="25" height="25" border="0"
alt="Current Map"></asp:HyperLink>
</span>
</td>
<td width="81" class="bodytext">
<asp:HyperLink ID=hplMapText Runat=server></asp:HyperLink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<asp:DataList runat="server"
Id="ChildDataList"
cellpadding="0"
cellspacing="0"
datasource='<%# Container.DataItem.Row.GetChildRows("LinkRelation") %
>'
Width=100%
ItemStyle-BackColor="#FFFFFF"
SeparatorStyle-BackColor="#FFFFFF"
BorderColor="#FFFFFF"
BorderWidth=0
AlternatingItemStyle-BackColor="#FFFFFF"
RepeatColumns=4>
<ItemTemplate>
<p>
<span class="bodytext">
<a href="Files/FileManager/<%# Container.DataItem("FileName") %>"><%#
Container.DataItem("FileName") %></a>
</span>
<br>
<span class="bodytext"><%# Format(Container.DataItem
("InsertDate"),"Long Date") %></span>
</p>
</ItemTemplate>
</asp:DataList>
</td>
</tr>
</ItemTemplate>
</asp:DataList>
Yahoo! Groups SponsorADVERTISEMENT
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/