Solved

add text to panel in code behind

Posted on 2007-12-05
3
2,062 Views
Last Modified: 2013-11-26
In ASP.NET 2.0 with C# I have a Panel.
In the code behind I add to this panel asp:hyperlink controls:
             HyperLink hl1 = new HyperLink();
                hl1.ID = "HL1";
                hl1.NavigateUrl = "~/Index.aspx";
                hl1.Text = "Home";
                pnlbreadcrumbs.Controls.Add(hl1);

                HyperLink hl2 = new HyperLink();
                hl2.ID = "HL1";
                hl2.NavigateUrl = "~/Index.aspx";
                hl2.Text = "HyperLink2";
                pnlbreadcrumbs.Controls.Add(hl2);
After each hyperlink I want to give the > sign which is ">"
How shall I add it to the panel in the code behind?
thankyou
anat

0
Comment
Question by:ANAT2403
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
DreamMaster earned 500 total points
ID: 20410036
You could add a literal after each hyperlink control, that way you could add whatever you want behind that.

So you'd get something like this:

HyperLink hl1 = new HyperLink();
hl1.ID = "HL1";
hl1.NavigateUrl = "~/index.aspx";
hl1.Text = "Home";
pnlbreadcrumbs.Controls.Add(hl1);

Literal lit1 = new Literal();
lit1.ID = "literal1";
lit1.Text = " > ";
pnlbreadcrumbs.Controls.Add(lit1);

Haven't tested this, but it should work.

Regards,
Max.
0
 

Author Comment

by:ANAT2403
ID: 20410076
Hi Max,
I took your idea and improved it.
                Label lbl1 = new Label();
                lbl1.Text = ">";
                pnlbreadcrumbs.Controls.Add(lbl1);
thankyou
Anat
0
 
LVL 19

Expert Comment

by:DreamMaster
ID: 20410340
Both would work. ;)

Glad to have been helpful :)

Regards,
Max.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now