Click here to Skip to main content
13,091,134 members (93,053 online)
Rate this:
Please Sign up or sign in to vote.
i have a database , on that i have SeeAlsoPageReference column, i saved value on that with the below code:

String PageRefs = txt_SeeAlsoPageReference.Text;
                if (PageRefs.Contains(";"))
                    String[] PageRefArray = PageRefs.Split(';');
                    for (int i = 0; i < PageRefArray.Length; i++)
                        seeAllpagereference += PageRefArray[i] + "<br/>";

i save the value in the database like:


<div id="SeeAlsoDiv">
           <asp:Label ID="lbl_SeeAlso" runat="server" Text="See Also" CssClass="lbl_seeAlso"></asp:Label><br />
           <asp:HyperLink ID="hyplnk_SeeAlso" href="" runat="server" Text=""></asp:HyperLink>

i used the code:

DataTable dt3 = DAL.OnlineHelp.PiiloHelp(Session["pageRef"].ToString(), Session["LanguageId"].ToInt32());
                if (dt3.Rows.Count > 0)
                    string SeeAlsoPageRef = dt3.Rows[0]["SeeAlsoPageReference"].ToString();
                    SeeAlsoPageRef = dt3.Rows[0]["SeeAlsoPageReference"].ToString().Replace("&lt;", "<");
                    SeeAlsoPageRef = dt3.Rows[0]["SeeAlsoPageReference"].ToString().Replace("&gt;", ">");
                    hyplnk_SeeAlso.Text = SeeAlsoPageRef;
with the above code it shows both the value but with 1 link.

i want when i retreive this value from database like:



and both act as a different hyperlink, so when i click on the 1st link it goes a/c to that link,
and when i click on the second link it goes on another link.

db column may contain more than 2 values.

this is my first post in code project. please tell how i do this.
Posted 10-Mar-13 23:17pm
Updated 11-Mar-13 10:22am
Maciej Los255.5K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need 2+ Hyperlink objects, not just 1. A hyperlink only has one link (NavigateUrl) to one place, so if you need multiple links you need multiple hyperlinks, and split the data between them.

You could create a ListView for this field with multiple values. It would have a TemplateColumn which contained a Hyperlink.

Something along the lines of this:

              <asp:HyperLink runat="server" ID="hyplnk_SeeAlso" NavigateUrl='<% BindingExpressionGoesHere %>' Text='<% BindingExpressionGoesHere %>'></asp:HyperLink>

Hope that helps.
Sampath Sridhar 11-Mar-13 23:36pm
This should work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100