Click here to Skip to main content
Rate this: bad
good
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:
 
ef35988c-9a70-493d-a98a-0320989b1a42
ef35988c-9a70-493d-a98a-0320989b1a42

 
aspx:
<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>
       </div>
 

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:
 
ef35988c-9a70-493d-a98a-0320989b1a42
 
9487fe04-01e0-02cd-079f-c6be42224537
 
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 11-Mar-13 0:17am
Edited 11-Mar-13 11:22am
Maciej Los151.9K
v2

1 solution

Rate this: bad
good
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:TemplateColumn>
            <ItemTemplate>
              <asp:HyperLink runat="server" ID="hyplnk_SeeAlso" NavigateUrl='<% BindingExpressionGoesHere %>' Text='<% BindingExpressionGoesHere %>'></asp:HyperLink>
            </ItemTemplate>
</asp:TemplateColumn>
 
Hope that helps.
  Permalink  
Comments
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 381
1 Sergey Alexandrovich Kryukov 265
2 Praneet Nadkar 237
3 Marcin Kozub 225
4 /\jmot 189
0 OriginalGriff 8,284
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,614
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


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