C# Function to create and attach ArrayList:
private void bindAlphabetList()
{
ArrayList al_az = new ArrayList();
for (int i = 65; i < datasource =" al_az;">
Source Code for the DataList:
<asp:DataList ID="dl_az" runat="server" RepeatDirection="Horizontal" >Note how an attribute is bound to the ArrayList value:
<ItemTemplate>
<asp:LinkButton ID="lb_letter" runat="server" Text='<%# Container.DataItem %>'></asp:LinkButton>
</ItemTemplate>
<SeparatorTemplate> | </SeparatorTemplate>
</asp:DataList>
Text='<%# Container.DataItem %>'
Alternatively an attribute can be bound to the Index of the DataListItem in which it is enclosed, as follows:
Text='<%# Container.ItemIndex %>'
or the Index of the GridViewRow if working with a GridView:
Text='<%# Container.DataItemIndex %>'
0 comments:
Post a Comment