Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataList with 2 arrayLists for hyperlink and label

Status
Not open for further replies.

Programming2007

Programmer
Nov 10, 2006
24
US
I am using a DataList to display a list of hyperlinks and labels. A user enters a search criteria and the page (hyperlink) is displayed along with a sentence (label)where the keyword is used. I have a Files arraylist of hyperlinks and a Descriptions arrayList of sentences. I don't know how to get this to work.



Here is my webForm1.aspx

<asp:datalist id="DataList1" runat="server">
<ItemTemplate>
<asp:HyperLink id=hypLocation runat="server" NavigateUrl="<%# Container.DataItem %>" text="<%# Container.DataItem %>">
</asp:HyperLink>
<asp:Label id=lblDescription runat="server" Visible="true" text="<%# Container.DataItem %>">
</asp:Label>
</ItemTemplate>
</asp:datalist>

Here is my WebForm1.vb

Descriptions.Add(strDescription)
DataList1.DataSource = Descriptions
DataList1.DataBind()
allFiles(inttemp) = (allFiles(inttemp).Replace("C:\SCoutline4", "allFiles(inttemp) = allFiles(inttemp).Replace("\", "/")
Files.Add(allFiles(inttemp))
DataList1.DataSource = Files
DataList1.DataBind()

I also tried the following and it didn't work

<asp:datalist id="DataList1" runat="server">
<ItemTemplate>
<asp:HyperLink id=hypLocation runat="server" NavigateUrl="<%#DataBinder.Eval(Container.DataItem,"Files") %>" text="<%#DataBinder.Eval(Container.DataItem,"Files") %>">
</asp:HyperLink>
<asp:Label id=lblDescription runat="server" Visible="true" text="<%#DataBinder.Eval(Container.DataItem,"Descriptions") %>">
</asp:Label>
</ItemTemplate>
</asp:datalist>

Here is my WebForm1.vb
Function getWebViewFiles(ByVal s As String()) As ICollection
Descriptions.Add(strDescription)
allFiles(inttemp) = (allFiles(inttemp).Replace("C:\SCoutline4", "allFiles(inttemp) = allFiles(inttemp).Replace("\", "/")
Files.Add(allFiles(inttemp))
DataList1.DataSource = getWebViewFiles(allFiles)
DataList1.DataBind()
 
You should post this in the ASP .NET forum at this link: forum855

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top