M
Mark
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 trying to use the FindControl
method inside the ItemCommand event of the DataList to get the contents of
the Label below, but it appears that the DataBinder code is making it a
child control of the lblInstructorEmplidDisplayed control, rather than
making it the text property of the Label itself. I'm open to other methods
.... I'd just like to figure out how to use the DataList rather than the
DataGrid to do it. Note that I'm not allowing the user to edit, delete or
update data ... just display it and allow the user to select a single record
using a button in the left most column.
Thanks in advance.
Mark
<aspataList id="dlDisplayNames" runat="server" DataKeyField="Emplid">
<ItemTemplate>
<TABLE border="1">
<tr>
<td>
<asp:Button CommandName="SelectInstructorName" runat="server"
ID="lbInstructor" Text="View" />
</td>
<td>
<asp:Label Runat="server" ID="lblInstructorEmplidDisplayed">
<%# DataBinder.Eval(Container.DataItem, "emplid") %>
</asp:Label>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "name") %>
</td>
</tr>
</TABLE>
</ItemTemplate>
</aspataList>
with 10 records of data. How do I programatically grab all the data in ALL
the columns of the selected record? I've been trying to use the FindControl
method inside the ItemCommand event of the DataList to get the contents of
the Label below, but it appears that the DataBinder code is making it a
child control of the lblInstructorEmplidDisplayed control, rather than
making it the text property of the Label itself. I'm open to other methods
.... I'd just like to figure out how to use the DataList rather than the
DataGrid to do it. Note that I'm not allowing the user to edit, delete or
update data ... just display it and allow the user to select a single record
using a button in the left most column.
Thanks in advance.
Mark
<aspataList id="dlDisplayNames" runat="server" DataKeyField="Emplid">
<ItemTemplate>
<TABLE border="1">
<tr>
<td>
<asp:Button CommandName="SelectInstructorName" runat="server"
ID="lbInstructor" Text="View" />
</td>
<td>
<asp:Label Runat="server" ID="lblInstructorEmplidDisplayed">
<%# DataBinder.Eval(Container.DataItem, "emplid") %>
</asp:Label>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem, "name") %>
</td>
</tr>
</TABLE>
</ItemTemplate>
</aspataList>