473,473 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DataList item not binding.

Hi,
I have a Datalist inside the ItemTemplate of another DataList. When I
drilldown, I'm not getting any data in either the itemtemplate or
headertemplate of the second DataList. I've confirmed that the
datasource is being populated properly, however the itemdatabound
event is not being fired. Here's some code:

<asp:datalist id="BatchList" runat="server"
repeatdirection="Vertical" headerstyle-cssclass="CategoryHeader"
alternatingitemstyle-cssclass="Content"
selecteditemstyle-cssclass="Selected" repeatcolumns="1" width="100%"
cellpadding="0" cellspacing="0" onitemcommand="BatchList_ItemCommand">
<headertemplate>
<table width="100%">
<tr>
Batches</tr>
<tr>
<td width="80px">Batch</td>
<td width="140px">Date</td>
<td width="80px">Material</td>
<td width="80px">Panels</td>
<td width="80px">Scrap</td>
<td width="80px">Yield</td>
</tr>
</table>
</headertemplate>
<itemtemplate>
<table border="0" cellpadding="5" cellspacing="0" width="100%"
cols="3">
<tr>
<td valign="top" width="80px">
<asp:linkbutton id="Batch" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Batch") %>' CommandName="select"
/></td>
<td width="150px">
<asp:label id="ProductionDate" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "ProductionDate") %>' Visible=True
/></td>
<td width="80px">
<asp:label id="Material" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Material") %>' Visible=True />
</td>
<td width="80px">
<asp:label id="Panels" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Panels") %>' Visible=True />
</td>
<td width="80px">
<asp:label id="ScrapQuantity" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "ScrapQuantity") %>' Visible=True
/>
</td>
<td width="80px" align="right">
<asp:label id="Yield" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Yield") %>' Visible=True />
</td>
</tr>
</table>
</itemtemplate>
<selecteditemtemplate>
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td valign="top" class="Content" width="80px">
<%# DataBinder.Eval(Container.DataItem, "Batch") %>
</td>
<td width="155px" class="Content">
<asp:label id="Label1" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "ProductionDate") %>' Visible=True
/></td>
<td width="80px" class="Content">
<asp:label id="Label10" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Material") %>' Visible=True />
</td>
<td width="80px" class="Content">
<asp:label id="Label11" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Panels") %>' Visible=True />
</td>
<td width="80px" class="Content">
<asp:label id="Label12" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "ScrapQuantity") %>' Visible=True
/>
</td>
<td width="80px" align="right" class="Content">
<asp:label id="Label13" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "Yield") %>' Visible=True />
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" class="OrderID">
<img src="images/spacer.gif" width="20" height="1">
</td>
<td>

<asp:datalist BorderWidth="3" id="BatchDetail" runat="server"
DataSource='<%# GetBatchDetail(DataBinder.Eval(Container.DataItem,
"Batch")) %>' OnItemDataBound="DebugBatchList"
RepeatDirection="Vertical" repeatcolumns="0" Width="100%"
CellPadding="0" cellspacing="0"
OnItemCommand="BatchDetail_ItemCommand" BorderColor="#ff0033"
Visible="true" ShowHeader="True" Enabled="True" GridLines="Both">
<itemtemplate>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100">
<asp:linkbutton id="Linkbutton1" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "AestheticBatch") %>'
CommandName="select" />
</td>
<td width="200">
<asp:label id="Label6" runat="server" Text='<%#
string.Format("{0:d}", DataBinder.Eval(Container.DataItem,
"BackBatch")) %>'/>
</td>
<td>
<asp:label id="Label7" runat="server" Text='<%#
string.Format("{0:d}", DataBinder.Eval(Container.DataItem,
"BackLength")) %>' />
</td>
</tr>
</table>
</itemtemplate>

Protected Sub BatchDetail_ItemCommand(ByVal Sender As Object,
ByVal e As DataListCommandEventArgs)
' change the selected index of Orders Datalist
Dim cmd As String = CType(e.CommandSource,
LinkButton).CommandName
Dim senderlist As DataList = CType(Sender, DataList)
If cmd = "select" Then
senderlist.SelectedIndex = e.Item.ItemIndex
End If
' re-bind to display orders info with new selected index.
senderlist.DataSource =
GetBatchDetail(CStr(ViewState(_batch)))
senderlist.DataBind()
End Sub

Protected Function GetBatchDetail(ByVal batch As Int32) As
TechStyle.Reports.Components.DrillDownReportCollec tion
If batch = 0 Then
batch = CStr(ViewState(_batch))
End If
Return TechStyle.Reports.Components.DrillDownReport.GetBa tchDetail(batch)
End Function

Public Sub DebugBatchList(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataListItemEventArgs)
Trace.Warn("DebugBatchList", "BatchList datasource: " &
Me.BatchList.DataSource.ToString)
End Sub
Nov 17 '05 #1
0 4929

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

Similar topics

2
by: Mark | last post by:
I have a datalist (see code below). Assume that the datalist is populated with 10 records of data. How do I programatically grab all the data in ALL the columns of the selected record? I've been...
5
by: Ian O'Rourke | last post by:
I'm a bit confused by the datalist. I can put an item in the datalist in editmode by the following dtlBooks.EditItemIndex = e.Item.ItemInde BindBooks( This works great, the problem is when I...
2
by: Shiju Poyilil | last post by:
Hi ! I have a requirement wherein i am binding a datalist which contains a label (Caption for the field) and some literal hidden fields and a dropdown list. When I am binding to the datalist.....
8
by: Nevyn Twyll | last post by:
I have a multi-level datalist setup: DataList1 DataList2 MyGrid I have columns explicitly defined for the grid in the html. Sometimes, On the initial Load() of the Page, I want to add extra...
5
by: Patrick.O.Ige | last post by:
I'm binding a CheckBoxlist below in the ItemDataBound(the CheckBoxList is in a Datalist) By doing "li.Selected = True" i can see all the checkBoxes are selected. But what i want is to be able...
6
by: Paul | last post by:
I am trying to use a DataList and the ItemTemplate. I am binding the Datalist to a SQL query that gives me a list of Items with a Parent Category. I want to loop through all the items, but...
3
by: Mirek Endys | last post by:
I have DataList as part of DataList item. DataList in DataList. The parent DataList working well including Edit command, that shows Edit template and correctly bind the data into edit template...
4
by: Nathan Sokalski | last post by:
I have a DataList that has an Button as one of the controls in it's ItemTemplate. The Button has a CommandName="delete" attribute, but when I click it the DeleteCommand event doesn't even get...
1
by: terminul | last post by:
Hi I have a datalist which loops through the categories and within the datalist I have a CheckBoxList which are bound on the DataList's OnItemDataBound. The only problem I have is retrieving...
0
by: Brian Lowe | last post by:
I'm in a web page and I have hierarchical data so I'm using 2 nested DataList controls. DataList1 is using a data source with rows of , , and where MoreData is a list. DataList1 has an...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.