Solved

.NET C# - CS page

Posted on 2008-06-11
2
250 Views
Last Modified: 2013-12-17
I have a Web site that has this code of the CS page

 {
                string title = user.getResourceTitle(file.Substring(file.LastIndexOf("\\") + 1));
                plcLinks.Controls.Add(new LiteralControl("<h2>" + title + "</h2>"));
                i++;
                HyperLink lnk = new HyperLink();
                lnk.Text = file.Substring(file.LastIndexOf("\\") + 1);
                lnk.NavigateUrl = "../secure/Uploads/" + file.Substring(file.LastIndexOf("\\")+1);
                lnk.Visible = true;
                lnk.ID = "lnk" + i.ToString();
                plcLinks.Controls.Add(lnk);
                plcLinks.Controls.Add(new LiteralControl("<br />"));
            }

I have the <h2> tag going to my title... I want the <p> tag to go to my links... I can't figure out how to incorporate the <p> tag to my links... I did not write this code... I am a dummy beginner.

Thank you...
0
Comment
Question by:DMcGown
2 Comments
 
LVL 3

Accepted Solution

by:
NIMTUG_Simon earned 250 total points
ID: 21764301
So what it looks like you are getting is

<h2>Some Title</h2>
<a href="someurl"/><br/>

If you are wanting

<h2>Some tiitle</h2>
<p><a href="someurl" /></p>

Then change

plcLinks.Controls.Add(lnk);
plcLinks.Controls.Add(new LiteralControl("<br />"));

to

plcLinks.Controls.Add(new LiteralControl("<p>"));
plcLinks.Controls.Add(lnk);
plcLinks.Controls.Add(new LiteralControl("</p>"));

0
 

Author Closing Comment

by:DMcGown
ID: 31466352
Perfect... That did the trick! - Thank you!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

17 Experts available now in Live!

Get 1:1 Help Now