Click here to Skip to main content
15,886,554 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

How can i get Output as below using ASP.NET C#,


XML
<asp:Panel ID="Panel_add_ddl_value" CssClass="modalPopup" runat="server" style="display:inherit;">
   <table  align="center">
   <tr>
   <td colspan="2" align="center">
       <asp:Label ID="lbl_add_value_category" runat="server" Font-Bold="true" CssClass="lbl"></asp:Label>
   </td>
   </tr>
   <tr>
    <td align="center" colspan="2">
       &nbsp;
    </td>
    <tr>
    <td>
        <asp:Label ID="lbl_add_value_question" runat="server" Font-Bold="true"></asp:Label>
    </td>
    <td align="center">
        <asp:TextBox ID="txt_ddl_value_add" ToolTip="Enter The Text To Add" runat="server"></asp:TextBox>
    </td>
    </tr>
    <tr>
    <td align="center" colspan="2">
       &nbsp;
    </td>
    </tr>

     <tr>
    <td align="center" colspan="2">
          <asp:Button ID="btn_set_ddl_value" ForeColor="Black" CssClass="yes"
            runat="server" Text="Set" onclick="btn_set_ddl_value_Click"
            ToolTip="Add Only For This Patient."/>
   &nbsp;&nbsp;
        <asp:Button ID="btn_add_ddl_value" ForeColor="Black" CssClass="yes"
            runat="server" Text="Add" onclick="btn_add_ddl_value_Click"
            ToolTip="Add Permanantly Into The List."/>


   &nbsp;&nbsp;
        <asp:Button ID="btn_cancel_ddl_value" ForeColor="Black" CssClass="yes" runat="server"
            Text="Cancel" ToolTip="Cancel" onclick="btn_cancel_ddl_value_Click" />
        </td>
    </tr>
    </table>
    </asp:Panel>



SQL
 when i run this code it returns controls like panel,TextBox,label etc in output,
But i want it as a text please tell me how to do this. 
For a reference stack overflow and code project display ASPX design code as a text.
Posted

1 solution

In those sites they are encoding the HTML tags. And display those encoded text in side pre HTML tag, so that browser will consider as text. If you will not do encode then browser will render as TextBox, Panel etc.

For instance, your HTML code is:
HTML
<p>This is a paragraph.</p>


Encoded format will be:
HTML
&lt;p&gt;This is a paragraph.&lt;/p&gt;


Step1:
Get encoded format of your HTML tag.

Please use below link to encode your HTML tag:

http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder[^]

Step2:
Please put encoded tags inside pre tag.

<pre lang="HTML">&amp;lt;p&amp;gt;This is a paragraph.&amp;lt;/p&amp;gt;</pre>
 
Share this answer
 
Comments
srishti_ 7-Sep-15 2:32am    
perfect Thanks .... I have one other question please have a look on that

http://www.codeproject.com/Questions/1027774/How-to-format-csharp-code-in-browser-as-shown-in-v

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900