For some reason, I am unable to get the text values from the 2 label controls within a datalist...can someone see something wrong that I'm doing? The datakey returns the number, but nothing else does...
html
Code:
Sub dlstKPI_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlstKPI.ItemCommand
Try
Me.lblReportID.Text = Me.dlstKPI.DataKeys(e.Item.ItemIndex)
Me.lblReportDescription.Text = CType(e.Item.FindControl("lblKPIDesc"), Label).Text
Me.lblName.Text = CType(e.Item.FindControl("lblKPIName"), Label).Text
Catch ex As Exception
Dim fp As New ClientCare.errorCatcher
fp.showMeTheError(ex)
fp = Nothing
End Try
End Sub
html
Code:
<asp:DataList id="dlstKPI" style="Z-INDEX: 100; LEFT: 56px; POSITION: absolute; TOP: 56px" runat="server"
RepeatColumns="2" OnItemCommand="dlstKPI_ItemCommand" DataKeyField="reportID" RepeatDirection="Horizontal"
ShowFooter="False" ShowHeader="False">
<ItemTemplate>
<TABLE id="Table1" style="WIDTH: 272px; HEIGHT: 20px" cellSpacing="1" cellPadding="1" width="272" border="0">
<TR>
<TD style="WIDTH: 22px">
<asp:ImageButton id="btnRID" runat="server" ImageUrl="images/kpiLogo.gif" CommandName="select">
</asp:ImageButton>
</TD>
<TD>
<asp:Label id="lblKPIName" runat="server" Font-Names="Arial" Font-Size="13px" Font-Bold="True" Font-Italic="True"><%# Databinder.Eval(Container,"DataItem.Name") %>
</asp:Label></TD>
</TR>
</TABLE>
<asp:Label id="lblKPIDesc" runat="server" Visible="False">
<%# Databinder.Eval(Container,"DataItem.Description") %>
</asp:Label>
</ItemTemplate>
</asp:DataList>