Extracting values from ArrayList

  • Thread starter Thread starter Sonny Sablan
  • Start date Start date
S

Sonny Sablan

AryUnderNav = New ArrayList()
AryUnderNav.Add("Under $50")
AryUnderNav.Add("$50 - $100")
AryUnderNav.Add("$100 - $200")
AryUnderNav.Add("$200 +")

UnderNav.DataSource = AryUnderNav
UnderNav.DataBind()

....


I want to list these items horizontally on the page. What is the syntax to get the value of each Array item?

Here is what I've tried to do.

<asp:DataList id="UnderNav" RepeatDirection="Horizontal" runat=server>
<ItemTemplate>

{{{{{{{{{{{ I want a URL here with the Index number in the href and the string value as the link text. }}}}}}}}}}

</ItemTemplate>
</asp:DataList>



Thanks

Sonny Sablan
 
Just do
<%# Container.DataItem %>

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


AryUnderNav = New ArrayList()
AryUnderNav.Add("Under $50")
AryUnderNav.Add("$50 - $100")
AryUnderNav.Add("$100 - $200")
AryUnderNav.Add("$200 +")

UnderNav.DataSource = AryUnderNav
UnderNav.DataBind()

...


I want to list these items horizontally on the page. What is the syntax to get the value of each Array item?

Here is what I've tried to do.

<asp:DataList id="UnderNav" RepeatDirection="Horizontal" runat=server>
<ItemTemplate>

{{{{{{{{{{{ I want a URL here with the Index number in the href and the string value as the link text. }}}}}}}}}}

</ItemTemplate>
</asp:DataList>



Thanks

Sonny Sablan
 
Thanks...

Also,

How do I extract the index of the data?
And how can I use a datalist that does not write a table?

I want to list the items without cells.

Sonny
 
Sonny:
Try
<%# Container.ItemIndex %> but remember that it's 0 based.

If you want more control over how your databound controls are created, I
suggest you look at the Repeater control which gives you great flexibility.

Karl
 
Back
Top