Solved

add text to panel in code behind

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

20 Experts available now in Live!

Get 1:1 Help Now