Solved

.NET C# - CS page

Posted on 2008-06-11
2
258 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
[X]
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
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
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 Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

688 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