Can't find TableCell in DataListPostedFile Is Nothing on DataGrid File UploadHow to cache images from a SQl Server 2005 database call?Problem with ajax hover menu extender controlDoes not show dynamic submenus of the Menu control in asp.netBinding Data to DataListchange text on a hyperlink in a datalistHow to bind DataList inside a DataList?GridView Lines Not Showing up in IEHow to find Html control in datalist?Binding dynamic datalist in C#

Show that there are infinitely more problems than we will ever be able to compute

Do I need to be legally qualified to install a Hive smart thermostat?

What is the maximum amount of diamond in one Minecraft game?

Why is there paternal, for fatherly, fraternal, for brotherly, but no similar word for sons?

My players like to search everything. What do they find?

What is this arch-and-tower near a road?

How did שְׁלֹמֹה (shlomo) become Solomon?

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

What does it mean for a bass player to play "on the one"?

How to travel between two stationary worlds in the least amount of time? (time dilation)

List comprehensions in Mathematica?

What/Where usage English vs Japanese

Did Stalin kill all Soviet officers involved in the Winter War?

What is exact meaning of “ich wäre gern”?

What are the differences of checking a self-signed certificate vs ignore it?

What is the addition in the re-released version of Avengers: Endgame?

How do both sides know the MTU

What is the name of the technique when an element is repeated at different scales?

Can 4 Joy cons connect to the same Switch?

In the Seventh Seal why does Death let the chess game happen?

How should I present a resort brochure in my general fiction?

Does Evolution Sage proliferate Blast Zone when played?

What instances can be solved today by modern solvers (pure LP)?

What's the big deal about the Nazgûl losing their horses?



Can't find TableCell in DataList


PostedFile Is Nothing on DataGrid File UploadHow to cache images from a SQl Server 2005 database call?Problem with ajax hover menu extender controlDoes not show dynamic submenus of the Menu control in asp.netBinding Data to DataListchange text on a hyperlink in a datalistHow to bind DataList inside a DataList?GridView Lines Not Showing up in IEHow to find Html control in datalist?Binding dynamic datalist in C#






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have an ASP.Net 4.6.1 DataList on a web page with methods for both OnItemDataBound and OnItemCreated:



<asp:DataList runat="server" ID="dlAssocDetail" HorizontalAlign="Center" OnEditCommand="dlAssocDetail_EditCommand" OnUpdateCommand="dlAssocDetail_UpdateCommand"
OnCancelCommand="dlAssocDetail_CancelCommand" OnItemCommand="dlAssocDetail_ItemCommand" OnItemDataBound="dlAssocDetail_ItemDataBound" OnItemCreated="dlAssocDetail_ItemCreated">
<ItemTemplate>
<asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
</asp:TableCell>
</asp:TableRow>
</asp:Table><br />
<asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Description: </b><asp:Label runat="server" ID="lbDesc" Text=<%# Bind("Description") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Enabled="false" Checked=<%# Bind("Approved") %> />
<b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" Enabled="false" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Status: </b><asp:Label runat="server" ID="lbStatus" Text=<%# Bind("OrderStatus") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Request Date: </b><asp:Label runat="server" ID="lbReqDate" Text=<%# Bind("RequestDate") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Order Date: </b><asp:Label runat="server" ID="lbOrderDate" Text=<%# Bind("OrderDate") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Received Date: </b><asp:Label runat="server" ID="lbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid/Reimb Date: </b><asp:Label runat="server" ID="lbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Total Amount: </b><asp:Label runat="server" ID="lbTotal" Text=<%# Bind("TotalAmount") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid By Firm: </b><asp:Label runat="server" ID="lbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid By Attorney: </b><asp:Label runat="server" ID="lbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" Enabled="false" SelectedValue=<%# Bind("OSID") %>
RepeatDirection="Horizontal">
<asp:ListItem Text="Apple" Value="1" />
<asp:ListItem Text="Windows" Value="2" />
</asp:RadioButtonList>
</asp:TableCell>
<asp:TableCell runat="server">
<b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" Enabled="false" SelectedValue=<%# Bind("DeviceTypeID") %>
RepeatDirection="Horizontal">
<asp:ListItem Text="Desktop" Value="1" />
<asp:ListItem Text="Laptop" Value="2" />
<asp:ListItem Text="iPad" Value="3" />
<asp:ListItem Text="Peripheral" Value="4" />
</asp:RadioButtonList>
</asp:TableCell>
<asp:TableCell runat="server" ID="tcSpecs">
<b>Specs: </b><br /><asp:HyperLink runat="server" ID="hlSpecs" Enabled="false" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" Enabled="false" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Button runat="server" ID="btnEdit" CommandName="Edit" Text="Edit" Font-Bold="true" Font-Names="Arial"
BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
<asp:Button runat="server" ID="btnNew" CommandName="New" Text="New" Font-Bold="true" Font-Names="Arial"
BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
<asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</ItemTemplate>
<EditItemTemplate>
<asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
</asp:TableCell>
</asp:TableRow>
</asp:Table><br />
<asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Description: </b><asp:TextBox runat="server" ID="tbDesc" Text=<%# Bind("Description") %> />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Checked=<%# Bind("Approved") %> />
<b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Status: </b><asp:DropDownList runat="server" ID="ddlStatus" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Request Date: </b><asp:ImageButton runat="server" ID="ibReqDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
<asp:TextBox runat="server" ID="tbReqDate" Text=<%# Bind("RequestDate") %> />
<ajax:CalendarExtender runat="server" ID="ceReqDate" TargetControlID="tbReqDate" PopupButtonID="ibReqDate" />
<asp:ImageButton runat="server" ID="ibDelReqDate" ImageUrl="~/images/cal_nodate.gif" /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
ControlToValidate="tbReqDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Order Date: </b><asp:ImageButton runat="server" ID="ibOrderDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
<asp:TextBox runat="server" ID="tbOrderDate" Text=<%# Bind("OrderDate") %> />
<ajax:CalendarExtender runat="server" ID="ceOrderDate" TargetControlID="tbOrderDate" PopupButtonID="ibOrderDate" />
<asp:ImageButton runat="server" ID="ibDelOrderDate" ImageUrl="~/images/cal_nodate.gif" /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
ControlToValidate="tbOrderDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Received Date: </b><asp:ImageButton runat="server" ID="ibReceivedDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
<asp:TextBox runat="server" ID="tbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
<ajax:CalendarExtender runat="server" ID="ceReceivedDate" TargetControlID="tbReceivedDate" PopupButtonID="ibReceivedDate" />
<asp:ImageButton runat="server" ID="ibDelReceivedDate" ImageUrl="~/images/cal_nodate.gif" /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
ControlToValidate="tbReceivedDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid/Reimb Date: </b><asp:ImageButton runat="server" ID="ibPaidDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
<asp:TextBox runat="server" ID="tbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
<ajax:CalendarExtender runat="server" ID="cePaidDate" TargetControlID="tbPaidDate" PopupButtonID="ibPaidDate" />
<asp:ImageButton runat="server" ID="ibDelPaidDate" ImageUrl="~/images/cal_nodate.gif" /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
ControlToValidate="tbPaidDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Total Amount: </b><asp:TextBox runat="server" ID="tbTotal" Text=<%# Bind("TotalAmount") %> /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbTotal"
ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid By Firm: </b><asp:TextBox runat="server" ID="tbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByFirm"
ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Paid By Attorney: </b><asp:TextBox runat="server" ID="tbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> /><br />
<asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByAttorney"
ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" SelectedValue=<%# Bind("OSID") %>
RepeatDirection="Horizontal">
<asp:ListItem Text="Apple" Value="1" />
<asp:ListItem Text="Windows" Value="2" />
</asp:RadioButtonList>
</asp:TableCell>
<asp:TableCell runat="server">
<b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" SelectedValue=<%# Bind("DeviceTypeID") %>
RepeatDirection="Horizontal">
<asp:ListItem Text="Desktop" Value="1" />
<asp:ListItem Text="Laptop" Value="2" />
<asp:ListItem Text="iPad" Value="3" />
<asp:ListItem Text="Peripheral" Value="4" />
</asp:RadioButtonList>
</asp:TableCell>
<asp:TableCell runat="server" ID="tcSpecs">
<b>Specs: </b><asp:HyperLink runat="server" ID="hlSpecs" />
</asp:TableCell>
<asp:TableCell runat="server">
<b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server">
<asp:Button runat="server" ID="btnUpdate" CommandName="Update" Text="Update" Font-Bold="true" Font-Names="Arial"
BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
<asp:Button runat="server" ID="btnCancel" CommandName="Cancel" Text="Cancel" Font-Bold="true" Font-Names="Arial"
BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
</asp:TableCell>
</asp:TableRow>
<asp:TableRow runat="server">
<asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
<asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</EditItemTemplate>
</asp:DataList>


I'm trying to find a TableCell in the DataList. The ID of the TableCell is tcSpecs. When either the ItemDataBound or ItemCreated event fires, it doesn't see tcSpecs, i.e., tcSpecs remains null. Here's my code:



protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");


protected void dlAssocDetail_ItemCreated(object sender, DataListItemEventArgs e)

TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");



What am I doing wrong? How do I find this TableCell?



Backing up a bit, what I'm trying to accomplish is to dynamically create a bunch of HyperLink controls on the page. I'm trying to find the TableCell so I have somewhere to put them. If anyone can suggest an alternative to using the TableCell, I'm open to that, too. Thanks much.










share|improve this question




























    0















    I have an ASP.Net 4.6.1 DataList on a web page with methods for both OnItemDataBound and OnItemCreated:



    <asp:DataList runat="server" ID="dlAssocDetail" HorizontalAlign="Center" OnEditCommand="dlAssocDetail_EditCommand" OnUpdateCommand="dlAssocDetail_UpdateCommand"
    OnCancelCommand="dlAssocDetail_CancelCommand" OnItemCommand="dlAssocDetail_ItemCommand" OnItemDataBound="dlAssocDetail_ItemDataBound" OnItemCreated="dlAssocDetail_ItemCreated">
    <ItemTemplate>
    <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table><br />
    <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Description: </b><asp:Label runat="server" ID="lbDesc" Text=<%# Bind("Description") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Enabled="false" Checked=<%# Bind("Approved") %> />
    <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" Enabled="false" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Status: </b><asp:Label runat="server" ID="lbStatus" Text=<%# Bind("OrderStatus") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Request Date: </b><asp:Label runat="server" ID="lbReqDate" Text=<%# Bind("RequestDate") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Order Date: </b><asp:Label runat="server" ID="lbOrderDate" Text=<%# Bind("OrderDate") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Received Date: </b><asp:Label runat="server" ID="lbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid/Reimb Date: </b><asp:Label runat="server" ID="lbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Total Amount: </b><asp:Label runat="server" ID="lbTotal" Text=<%# Bind("TotalAmount") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid By Firm: </b><asp:Label runat="server" ID="lbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid By Attorney: </b><asp:Label runat="server" ID="lbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" Enabled="false" SelectedValue=<%# Bind("OSID") %>
    RepeatDirection="Horizontal">
    <asp:ListItem Text="Apple" Value="1" />
    <asp:ListItem Text="Windows" Value="2" />
    </asp:RadioButtonList>
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" Enabled="false" SelectedValue=<%# Bind("DeviceTypeID") %>
    RepeatDirection="Horizontal">
    <asp:ListItem Text="Desktop" Value="1" />
    <asp:ListItem Text="Laptop" Value="2" />
    <asp:ListItem Text="iPad" Value="3" />
    <asp:ListItem Text="Peripheral" Value="4" />
    </asp:RadioButtonList>
    </asp:TableCell>
    <asp:TableCell runat="server" ID="tcSpecs">
    <b>Specs: </b><br /><asp:HyperLink runat="server" ID="hlSpecs" Enabled="false" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" Enabled="false" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <asp:Button runat="server" ID="btnEdit" CommandName="Edit" Text="Edit" Font-Bold="true" Font-Names="Arial"
    BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
    <asp:Button runat="server" ID="btnNew" CommandName="New" Text="New" Font-Bold="true" Font-Names="Arial"
    BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
    <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table><br />
    <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Description: </b><asp:TextBox runat="server" ID="tbDesc" Text=<%# Bind("Description") %> />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Checked=<%# Bind("Approved") %> />
    <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Status: </b><asp:DropDownList runat="server" ID="ddlStatus" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Request Date: </b><asp:ImageButton runat="server" ID="ibReqDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
    <asp:TextBox runat="server" ID="tbReqDate" Text=<%# Bind("RequestDate") %> />
    <ajax:CalendarExtender runat="server" ID="ceReqDate" TargetControlID="tbReqDate" PopupButtonID="ibReqDate" />
    <asp:ImageButton runat="server" ID="ibDelReqDate" ImageUrl="~/images/cal_nodate.gif" /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
    ControlToValidate="tbReqDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
    SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Order Date: </b><asp:ImageButton runat="server" ID="ibOrderDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
    <asp:TextBox runat="server" ID="tbOrderDate" Text=<%# Bind("OrderDate") %> />
    <ajax:CalendarExtender runat="server" ID="ceOrderDate" TargetControlID="tbOrderDate" PopupButtonID="ibOrderDate" />
    <asp:ImageButton runat="server" ID="ibDelOrderDate" ImageUrl="~/images/cal_nodate.gif" /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
    ControlToValidate="tbOrderDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
    SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Received Date: </b><asp:ImageButton runat="server" ID="ibReceivedDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
    <asp:TextBox runat="server" ID="tbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
    <ajax:CalendarExtender runat="server" ID="ceReceivedDate" TargetControlID="tbReceivedDate" PopupButtonID="ibReceivedDate" />
    <asp:ImageButton runat="server" ID="ibDelReceivedDate" ImageUrl="~/images/cal_nodate.gif" /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
    ControlToValidate="tbReceivedDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
    SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid/Reimb Date: </b><asp:ImageButton runat="server" ID="ibPaidDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
    <asp:TextBox runat="server" ID="tbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
    <ajax:CalendarExtender runat="server" ID="cePaidDate" TargetControlID="tbPaidDate" PopupButtonID="ibPaidDate" />
    <asp:ImageButton runat="server" ID="ibDelPaidDate" ImageUrl="~/images/cal_nodate.gif" /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
    ControlToValidate="tbPaidDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
    SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Total Amount: </b><asp:TextBox runat="server" ID="tbTotal" Text=<%# Bind("TotalAmount") %> /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbTotal"
    ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid By Firm: </b><asp:TextBox runat="server" ID="tbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByFirm"
    ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Paid By Attorney: </b><asp:TextBox runat="server" ID="tbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> /><br />
    <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByAttorney"
    ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" SelectedValue=<%# Bind("OSID") %>
    RepeatDirection="Horizontal">
    <asp:ListItem Text="Apple" Value="1" />
    <asp:ListItem Text="Windows" Value="2" />
    </asp:RadioButtonList>
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" SelectedValue=<%# Bind("DeviceTypeID") %>
    RepeatDirection="Horizontal">
    <asp:ListItem Text="Desktop" Value="1" />
    <asp:ListItem Text="Laptop" Value="2" />
    <asp:ListItem Text="iPad" Value="3" />
    <asp:ListItem Text="Peripheral" Value="4" />
    </asp:RadioButtonList>
    </asp:TableCell>
    <asp:TableCell runat="server" ID="tcSpecs">
    <b>Specs: </b><asp:HyperLink runat="server" ID="hlSpecs" />
    </asp:TableCell>
    <asp:TableCell runat="server">
    <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server">
    <asp:Button runat="server" ID="btnUpdate" CommandName="Update" Text="Update" Font-Bold="true" Font-Names="Arial"
    BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
    <asp:Button runat="server" ID="btnCancel" CommandName="Cancel" Text="Cancel" Font-Bold="true" Font-Names="Arial"
    BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
    </asp:TableCell>
    </asp:TableRow>
    <asp:TableRow runat="server">
    <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
    <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
    </asp:TableCell>
    </asp:TableRow>
    </asp:Table>
    </EditItemTemplate>
    </asp:DataList>


    I'm trying to find a TableCell in the DataList. The ID of the TableCell is tcSpecs. When either the ItemDataBound or ItemCreated event fires, it doesn't see tcSpecs, i.e., tcSpecs remains null. Here's my code:



    protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

    TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");


    protected void dlAssocDetail_ItemCreated(object sender, DataListItemEventArgs e)

    TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");



    What am I doing wrong? How do I find this TableCell?



    Backing up a bit, what I'm trying to accomplish is to dynamically create a bunch of HyperLink controls on the page. I'm trying to find the TableCell so I have somewhere to put them. If anyone can suggest an alternative to using the TableCell, I'm open to that, too. Thanks much.










    share|improve this question
























      0












      0








      0








      I have an ASP.Net 4.6.1 DataList on a web page with methods for both OnItemDataBound and OnItemCreated:



      <asp:DataList runat="server" ID="dlAssocDetail" HorizontalAlign="Center" OnEditCommand="dlAssocDetail_EditCommand" OnUpdateCommand="dlAssocDetail_UpdateCommand"
      OnCancelCommand="dlAssocDetail_CancelCommand" OnItemCommand="dlAssocDetail_ItemCommand" OnItemDataBound="dlAssocDetail_ItemDataBound" OnItemCreated="dlAssocDetail_ItemCreated">
      <ItemTemplate>
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table><br />
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Description: </b><asp:Label runat="server" ID="lbDesc" Text=<%# Bind("Description") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Enabled="false" Checked=<%# Bind("Approved") %> />
      <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" Enabled="false" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Status: </b><asp:Label runat="server" ID="lbStatus" Text=<%# Bind("OrderStatus") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Request Date: </b><asp:Label runat="server" ID="lbReqDate" Text=<%# Bind("RequestDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Order Date: </b><asp:Label runat="server" ID="lbOrderDate" Text=<%# Bind("OrderDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Received Date: </b><asp:Label runat="server" ID="lbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid/Reimb Date: </b><asp:Label runat="server" ID="lbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Total Amount: </b><asp:Label runat="server" ID="lbTotal" Text=<%# Bind("TotalAmount") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Firm: </b><asp:Label runat="server" ID="lbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Attorney: </b><asp:Label runat="server" ID="lbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" Enabled="false" SelectedValue=<%# Bind("OSID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Apple" Value="1" />
      <asp:ListItem Text="Windows" Value="2" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" Enabled="false" SelectedValue=<%# Bind("DeviceTypeID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Desktop" Value="1" />
      <asp:ListItem Text="Laptop" Value="2" />
      <asp:ListItem Text="iPad" Value="3" />
      <asp:ListItem Text="Peripheral" Value="4" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server" ID="tcSpecs">
      <b>Specs: </b><br /><asp:HyperLink runat="server" ID="hlSpecs" Enabled="false" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" Enabled="false" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <asp:Button runat="server" ID="btnEdit" CommandName="Edit" Text="Edit" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      <asp:Button runat="server" ID="btnNew" CommandName="New" Text="New" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
      <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table>
      </ItemTemplate>
      <EditItemTemplate>
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table><br />
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Description: </b><asp:TextBox runat="server" ID="tbDesc" Text=<%# Bind("Description") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Checked=<%# Bind("Approved") %> />
      <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Status: </b><asp:DropDownList runat="server" ID="ddlStatus" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Request Date: </b><asp:ImageButton runat="server" ID="ibReqDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbReqDate" Text=<%# Bind("RequestDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceReqDate" TargetControlID="tbReqDate" PopupButtonID="ibReqDate" />
      <asp:ImageButton runat="server" ID="ibDelReqDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbReqDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Order Date: </b><asp:ImageButton runat="server" ID="ibOrderDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbOrderDate" Text=<%# Bind("OrderDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceOrderDate" TargetControlID="tbOrderDate" PopupButtonID="ibOrderDate" />
      <asp:ImageButton runat="server" ID="ibDelOrderDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbOrderDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Received Date: </b><asp:ImageButton runat="server" ID="ibReceivedDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceReceivedDate" TargetControlID="tbReceivedDate" PopupButtonID="ibReceivedDate" />
      <asp:ImageButton runat="server" ID="ibDelReceivedDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbReceivedDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid/Reimb Date: </b><asp:ImageButton runat="server" ID="ibPaidDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
      <ajax:CalendarExtender runat="server" ID="cePaidDate" TargetControlID="tbPaidDate" PopupButtonID="ibPaidDate" />
      <asp:ImageButton runat="server" ID="ibDelPaidDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbPaidDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Total Amount: </b><asp:TextBox runat="server" ID="tbTotal" Text=<%# Bind("TotalAmount") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbTotal"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Firm: </b><asp:TextBox runat="server" ID="tbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByFirm"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Attorney: </b><asp:TextBox runat="server" ID="tbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByAttorney"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" SelectedValue=<%# Bind("OSID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Apple" Value="1" />
      <asp:ListItem Text="Windows" Value="2" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" SelectedValue=<%# Bind("DeviceTypeID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Desktop" Value="1" />
      <asp:ListItem Text="Laptop" Value="2" />
      <asp:ListItem Text="iPad" Value="3" />
      <asp:ListItem Text="Peripheral" Value="4" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server" ID="tcSpecs">
      <b>Specs: </b><asp:HyperLink runat="server" ID="hlSpecs" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <asp:Button runat="server" ID="btnUpdate" CommandName="Update" Text="Update" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      <asp:Button runat="server" ID="btnCancel" CommandName="Cancel" Text="Cancel" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
      <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table>
      </EditItemTemplate>
      </asp:DataList>


      I'm trying to find a TableCell in the DataList. The ID of the TableCell is tcSpecs. When either the ItemDataBound or ItemCreated event fires, it doesn't see tcSpecs, i.e., tcSpecs remains null. Here's my code:



      protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

      TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");


      protected void dlAssocDetail_ItemCreated(object sender, DataListItemEventArgs e)

      TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");



      What am I doing wrong? How do I find this TableCell?



      Backing up a bit, what I'm trying to accomplish is to dynamically create a bunch of HyperLink controls on the page. I'm trying to find the TableCell so I have somewhere to put them. If anyone can suggest an alternative to using the TableCell, I'm open to that, too. Thanks much.










      share|improve this question














      I have an ASP.Net 4.6.1 DataList on a web page with methods for both OnItemDataBound and OnItemCreated:



      <asp:DataList runat="server" ID="dlAssocDetail" HorizontalAlign="Center" OnEditCommand="dlAssocDetail_EditCommand" OnUpdateCommand="dlAssocDetail_UpdateCommand"
      OnCancelCommand="dlAssocDetail_CancelCommand" OnItemCommand="dlAssocDetail_ItemCommand" OnItemDataBound="dlAssocDetail_ItemDataBound" OnItemCreated="dlAssocDetail_ItemCreated">
      <ItemTemplate>
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table><br />
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Description: </b><asp:Label runat="server" ID="lbDesc" Text=<%# Bind("Description") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Enabled="false" Checked=<%# Bind("Approved") %> />
      <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" Enabled="false" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Status: </b><asp:Label runat="server" ID="lbStatus" Text=<%# Bind("OrderStatus") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Request Date: </b><asp:Label runat="server" ID="lbReqDate" Text=<%# Bind("RequestDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Order Date: </b><asp:Label runat="server" ID="lbOrderDate" Text=<%# Bind("OrderDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Received Date: </b><asp:Label runat="server" ID="lbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid/Reimb Date: </b><asp:Label runat="server" ID="lbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Total Amount: </b><asp:Label runat="server" ID="lbTotal" Text=<%# Bind("TotalAmount") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Firm: </b><asp:Label runat="server" ID="lbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Attorney: </b><asp:Label runat="server" ID="lbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" Enabled="false" SelectedValue=<%# Bind("OSID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Apple" Value="1" />
      <asp:ListItem Text="Windows" Value="2" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" Enabled="false" SelectedValue=<%# Bind("DeviceTypeID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Desktop" Value="1" />
      <asp:ListItem Text="Laptop" Value="2" />
      <asp:ListItem Text="iPad" Value="3" />
      <asp:ListItem Text="Peripheral" Value="4" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server" ID="tcSpecs">
      <b>Specs: </b><br /><asp:HyperLink runat="server" ID="hlSpecs" Enabled="false" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" Enabled="false" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <asp:Button runat="server" ID="btnEdit" CommandName="Edit" Text="Edit" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      <asp:Button runat="server" ID="btnNew" CommandName="New" Text="New" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
      <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table>
      </ItemTemplate>
      <EditItemTemplate>
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>User ID: </b><asp:Label runat="server" ID="lbEID" Text=<%# Bind("EmployeeID") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Attorney Name: </b><asp:Label runat="server" ID="lbName" Text=<%# Bind("AttorneyName") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Title: </b><asp:Label runat="server" ID="lbTitle" Text=<%# Bind("Title") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Anniversary Date: </b><asp:Label runat="server" ID="lbADate" Text=<%# Bind("AnniversaryDate") %> />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Balance: </b><asp:Label runat="server" ID="lbBalance" Text=<%# Bind("Balance") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Allotment Amount: </b><asp:Label runat="server" ID="lbAAmt" Text=<%# Bind("AllotmentAmount") %> />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table><br />
      <asp:Table runat="server" Font-Names="Arial" HorizontalAlign="Center" CellPadding="20" CellSpacing="20" BackColor="WhiteSmoke" BorderColor="LightGray">
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Description: </b><asp:TextBox runat="server" ID="tbDesc" Text=<%# Bind("Description") %> />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Approved: </b><asp:CheckBox runat="server" ID="cbApproved" Checked=<%# Bind("Approved") %> />
      <b>Rejected: </b><asp:CheckBox runat="server" ID="cbRejected" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Status: </b><asp:DropDownList runat="server" ID="ddlStatus" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Request Date: </b><asp:ImageButton runat="server" ID="ibReqDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbReqDate" Text=<%# Bind("RequestDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceReqDate" TargetControlID="tbReqDate" PopupButtonID="ibReqDate" />
      <asp:ImageButton runat="server" ID="ibDelReqDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbReqDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Order Date: </b><asp:ImageButton runat="server" ID="ibOrderDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbOrderDate" Text=<%# Bind("OrderDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceOrderDate" TargetControlID="tbOrderDate" PopupButtonID="ibOrderDate" />
      <asp:ImageButton runat="server" ID="ibDelOrderDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbOrderDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Received Date: </b><asp:ImageButton runat="server" ID="ibReceivedDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbReceivedDate" Text=<%# Bind("ReceivedDate") %> />
      <ajax:CalendarExtender runat="server" ID="ceReceivedDate" TargetControlID="tbReceivedDate" PopupButtonID="ibReceivedDate" />
      <asp:ImageButton runat="server" ID="ibDelReceivedDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbReceivedDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid/Reimb Date: </b><asp:ImageButton runat="server" ID="ibPaidDate" ImageUrl="~/images/Calendar-icon.png" AlternateText="Click here to display calendar" />
      <asp:TextBox runat="server" ID="tbPaidDate" Text=<%# Bind("Paid_ReimbDate") %> />
      <ajax:CalendarExtender runat="server" ID="cePaidDate" TargetControlID="tbPaidDate" PopupButtonID="ibPaidDate" />
      <asp:ImageButton runat="server" ID="ibDelPaidDate" ImageUrl="~/images/cal_nodate.gif" /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+[-/][0-9]+[-/][0-9][0-9][0-9][0-9]$"
      ControlToValidate="tbPaidDate" ErrorMessage="Correct Format is MM/DD/YYYY" Font-Bold="true" ForeColor="Red"
      SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Total Amount: </b><asp:TextBox runat="server" ID="tbTotal" Text=<%# Bind("TotalAmount") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbTotal"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Firm: </b><asp:TextBox runat="server" ID="tbByFirm" Text=<%# Bind("Paid_Reimb_Amt_ByFirm") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByFirm"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Paid By Attorney: </b><asp:TextBox runat="server" ID="tbByAttorney" Text=<%# Bind("PaidAmountByAttorney") %> /><br />
      <asp:RegularExpressionValidator runat="server" ValidationExpression="^[0-9]+.0,1[0-9]0,2$" ControlToValidate="tbByAttorney"
      ErrorMessage="Must be a number" Font-Bold="true" ForeColor="Red" SetFocusOnError="true" Font-Size="XX-Small" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <b>Operating System: </b><asp:RadioButtonList runat="server" ID="rblOS" SelectedValue=<%# Bind("OSID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Apple" Value="1" />
      <asp:ListItem Text="Windows" Value="2" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Device Type: </b><asp:RadioButtonList runat="server" ID="rblDType" SelectedValue=<%# Bind("DeviceTypeID") %>
      RepeatDirection="Horizontal">
      <asp:ListItem Text="Desktop" Value="1" />
      <asp:ListItem Text="Laptop" Value="2" />
      <asp:ListItem Text="iPad" Value="3" />
      <asp:ListItem Text="Peripheral" Value="4" />
      </asp:RadioButtonList>
      </asp:TableCell>
      <asp:TableCell runat="server" ID="tcSpecs">
      <b>Specs: </b><asp:HyperLink runat="server" ID="hlSpecs" />
      </asp:TableCell>
      <asp:TableCell runat="server">
      <b>Upload: </b><asp:FileUpload runat="server" ID="fluUpload" AllowMultiple="true" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server">
      <asp:Button runat="server" ID="btnUpdate" CommandName="Update" Text="Update" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      <asp:Button runat="server" ID="btnCancel" CommandName="Cancel" Text="Cancel" Font-Bold="true" Font-Names="Arial"
      BackColor="WhiteSmoke" BorderStyle="Outset" Height="40" Width="100" Font-Size="Large" />
      </asp:TableCell>
      </asp:TableRow>
      <asp:TableRow runat="server">
      <asp:TableCell runat="server" ColumnSpan="3" HorizontalAlign="Center">
      <asp:Label runat="server" ID="lbSuccess" Font-Bold="true" Font-Names="Arial" Font-Size="X-Small" ForeColor="Red" />
      </asp:TableCell>
      </asp:TableRow>
      </asp:Table>
      </EditItemTemplate>
      </asp:DataList>


      I'm trying to find a TableCell in the DataList. The ID of the TableCell is tcSpecs. When either the ItemDataBound or ItemCreated event fires, it doesn't see tcSpecs, i.e., tcSpecs remains null. Here's my code:



      protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

      TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");


      protected void dlAssocDetail_ItemCreated(object sender, DataListItemEventArgs e)

      TableCell tc = (TableCell)e.Item.FindControl("tbSpecs");



      What am I doing wrong? How do I find this TableCell?



      Backing up a bit, what I'm trying to accomplish is to dynamically create a bunch of HyperLink controls on the page. I'm trying to find the TableCell so I have somewhere to put them. If anyone can suggest an alternative to using the TableCell, I'm open to that, too. Thanks much.







      asp.net data-binding datalist






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 19:02









      MelanieMelanie

      2,0575 gold badges29 silver badges45 bronze badges




      2,0575 gold badges29 silver badges45 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I figured this out. First you have to find the Table, then the TableRow, then the TableCell. So:



          protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

          Table ta = (Table)e.Item.FindControl("myTable");
          foreach (TableRow row in ta.Rows)
          foreach (TableCell cell in row.Cells)
          //do something






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344811%2fcant-find-tablecell-in-datalist%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I figured this out. First you have to find the Table, then the TableRow, then the TableCell. So:



            protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

            Table ta = (Table)e.Item.FindControl("myTable");
            foreach (TableRow row in ta.Rows)
            foreach (TableCell cell in row.Cells)
            //do something






            share|improve this answer



























              0














              I figured this out. First you have to find the Table, then the TableRow, then the TableCell. So:



              protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

              Table ta = (Table)e.Item.FindControl("myTable");
              foreach (TableRow row in ta.Rows)
              foreach (TableCell cell in row.Cells)
              //do something






              share|improve this answer

























                0












                0








                0







                I figured this out. First you have to find the Table, then the TableRow, then the TableCell. So:



                protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

                Table ta = (Table)e.Item.FindControl("myTable");
                foreach (TableRow row in ta.Rows)
                foreach (TableCell cell in row.Cells)
                //do something






                share|improve this answer













                I figured this out. First you have to find the Table, then the TableRow, then the TableCell. So:



                protected void dlAssocDetail_ItemDataBound(object sender, DataListItemEventArgs e)

                Table ta = (Table)e.Item.FindControl("myTable");
                foreach (TableRow row in ta.Rows)
                foreach (TableCell cell in row.Cells)
                //do something







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 18:22









                MelanieMelanie

                2,0575 gold badges29 silver badges45 bronze badges




                2,0575 gold badges29 silver badges45 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344811%2fcant-find-tablecell-in-datalist%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현