ws11
asked on
Hide and show controls in a ListView's ItemTemplate
Is it possible in a ListView's ItemTemplate to reference a Label in code-behind onload or method? I want to make visible dynamically each Label control based on my column count of my dataset.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I think I will submit this in a different question. You accurately answered my question. Thanks.
ASKER
Is it possible to do something like article ID: 21113426 and place it inside the layout template or item template?
call in code-behind
dynamicTable = Build_Dynamic_Table();
call in code-behind
dynamicTable = Build_Dynamic_Table();
<LayoutTemplate>
<div class="lvBackground">
<asp:Table id="dynamicTable" runat="server" />
</div>
</LayoutTemplate>
or
<ItemTemplate>
<div class="lvBackground">
<asp:Table id="dynamicTable" runat="server" />
</div>
</ItemTemplate>
protected Table Build_Dynamic_Table()
{
Table tDynamicTable;
TableRow trRow;
TableCell tcCell;
tDynamicTable = new Table();
for (int y = 1; y <= 10; y++)
{
trRow = new TableRow();
for (int x = 1; x <= 5; x++)
{
tcCell = new TableCell();
tcCell.Text = "Add text here";
trRow.Cells.Add(tcCell);
}
tDynamicTable.Rows.Add(trRow);
}
return tDynamicTable;
}
ASKER