Note that there are some explanatory texts on larger screens.

plurals
  1. PORender < instead of < in ASP.NET
    text
    copied!<p>I'm writing a small page to show the employees in our company. I've written a query to pull the info from our database. Then I'm binding that to a GridView to do the dirty work. Here is the query.</p> <pre><code>"SELECT tblEmpID.empid AS [Empl ID], tblEmpID.posno AS [Pos #], [name] &amp; ""&lt;br /&gt;"" &amp; [jcn] &amp; ""("" &amp; [jcc] &amp; "")"" AS [Name/Job], [orgno] &amp; "" - "" &amp; [depname] AS Department, tblEmpID.[status] AS Status " &amp; _ "FROM tblEmpID " &amp; _ "ORDER BY [orgno] &amp; "" - "" &amp; [depname], tblEmpID.name " </code></pre> <p>As you can see, I'm trying to include a <br /> inside the SQL so when it renders it will look like:</p> <pre><code>Name Job Description </code></pre> <p>But when it renders it renders as </p> <pre><code>&amp;lt; and &amp;gt; </code></pre> <p>Effectively showing the &lt;br /&gt; in the record instead of formatting it like I want. </p> <p>So how to I make it render like I want? I've already tried escaping the &lt; with \ and that did not work.</p> <hr> <p><strong>EDIT:</strong> Thanks gfrizzle. Your answer set me down the right path. Also, thank you NYSystemsAnalyst. Your answer helped me think of a different way to do things in the future. Ultimately, I found a different solution. I put this code in the GridView1_RowDataBound event and it does what I need.</p> <pre><code>If e.Row.RowType = DataControlRowType.DataRow Then Dim cells As TableCellCollection = e.Row.Cells For Each cell As TableCell In cells cell.Text = Server.HtmlDecode(cell.Text) Next End If </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload