Solved

.NET C# - CS page

Posted on 2008-06-11
2
255 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

830 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