Hi All, I realized the DetailsView shows data like this:
COLUMN1 | value
COLUMN2 | value
COLUMN3 | value
However, one of my columns have more than one values and the output that I want to show like this:
COLUMN1 | value
COLUMN2 | value1 (show as a hyperlink that links to another URL_hyperlink column in the database)
| value2 (show as a hyperlink that links to another URL_hyperlink column in the database)
| value3 (show as a hyperlink that links to another URL_hyperlink column in the database)
COLUMN3 | value
If you run a query like this in SQL server: Select Column1, Column2, Hyperlink, Code from Table then the output is (I gave you one record as an example)
Column1 Column2 Hyperlink Code
======= ========= ==========
Apple Red http://www.apple.com/Red.html 0
Apple Green http://www.apple.com/Green.html 0
Apple Yellow Nolink_available 1
The output that I would like to see on web page is (using <asp:DetailsView>):
Column1 Apple
Column2 Red //this is a hyperlink that links to http://www.apple.com/Red.html
Green //this is a hyperlink that links to http://www.apple.com/Green.html
Yellow //nolink available so this is just text
The output that I am seeing on my current web page using the code below is:
Column1 Apple
Column2 Red (link to http://www.apple.com/Red.html)
Note: Column2 only displays Red. It should display 3 items: Red, Green, Yellow with hyperlink where it's appropriate (meaning where Code = 0).
This is my code and it works. However, it only shows Value1 as a hyperlink. I need it to show all the values.
<asp:TemplateField HeaderText ="COLUMN2">
<ItemTemplate>
<asp:Label Text='<% #Eval("COLUMN2")%> ' Visible='<%# Convert.ToInt32(Eval("A")) <=0 ? false :true %>' runat ="server" />
<asp:HyperLink runat="server" ID ="h1"
NavigateUrl='<%# Eval("URL_hyperlink", "~/{0}") %> '
Visible='<%# Convert.ToInt32(Eval("A")) <= 0 ? true : false %>' Text='<% #Eval("COLUMN2") + "<br>"%>' Target="_xmlwindow">
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
Thanks so much for any input you may provide.