Inserting line break in gridview header text

asp.net , csharp , db Newcastle upon Tyne, United Kingdom
  • 9 years ago

    Hi

    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")

    Regards,
    Shiji

  • 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)

    Next

    Anyway thanks for ur reply.

  • 8 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).

Contribute

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.

“Nine people can't make a baby in a month.” - Fred Brooks