Extracting values from ArrayList

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
 
K

Karl Seguin

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
 
S

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
 
K

Karl Seguin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top