Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

add text to panel in code behind

Posted on 2007-12-05
3
2,095 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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