Click here to Skip to main content
11,803,495 members (72,192 online)
Rate this: bad
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
Edited 11-Mar-13 10:22am
Maciej Los202.3K

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 at 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
0 OriginalGriff 375
1 CPallini 290
2 F-ES Sitecore 270
3 Sergey Alexandrovich Kryukov 234
4 CHill60 220
0 OriginalGriff 3,000
1 Maciej Los 1,910
2 KrunalRohit 1,862
3 CPallini 1,755
4 Richard MacCutchan 1,187

Advertise | Privacy | Mobile
Web01 | 2.8.151002.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2015
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