Inserting line break in gridview header text , csharp , db Newcastle upon Tyne, United Kingdom
  • 9 years ago


    I have binded the gridview with the datatable.In the header part,line break have to be inserted but when i give <br /> in the header,it gives the line break but the tag <br /> is also displayed.Can any one help me to solve this issue?

    For example:
    dtrow("Additional Purchases <br /> P/C/A")


  • 9 years ago

    Hi I got the solution.... 

    I told am getting the line break using <br /> but the tag s also displaying.

    We can remove the <br /> tag using html decode like this

    For Each c As TableCell In grdTrxncount.HeaderRow.Cells

    c.Text = HttpUtility.HtmlDecode(c.Text)


    Anyway thanks for ur reply.

  • 9 years ago
    Hi, you can simply set the property (of Boundfiled) i.e., HtmlEncode to false.

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves” - Alan Kay