Home > DeveloperSection > Forums > Disabling HTMLencode in ASP.NET and C#
Chintoo Semi

Total Post:135

Points:947
Posted on    November-13-2014 10:37 PM

 ASP.Net C#  Gridview 
Ratings:


 1 Reply(s)
 720  View(s)
Rate this:

I am using DataTable to populate data in GridView in ASP.NET I am trying to place a line break in a cell inside the DataGrid View I used

   "data1+<br>+data2"

to place a line break.I am manipulating this data from C# which is being generated dynamically.Because of HTML encoding 
is replaced as

 lt;brgt;

So please tell me how to disable that html encoding if possible for that gridView.



john rob

Total Post:108

Points:756
Posted on    November-14-2014 1:58 AM

TemplateField allows you to add html inside a cell, as

<asp:GridView ID="gv" runat="server" AutogenerateColumns = "false">

 <columns>

    <asp:BoundField DataField="col_name" HeaderText="Header"/>

    <asp:TemplateField>

      <ItemTemplate>

         '<%#Eval("data1")%>'

          <br/>

         '<%#Eval("data2")%>'

      </ItemTemplate>

    </asp:TemplateField>

 <columns>

</asp:GridView>


Don't want to miss updates? Please click the below button!

Follow MindStick