Sabyasachi Mukherjee
Sabyasachi Mukherjee

Reputation: 303

HTML title attribute line break

I am trying to generate a tool tip text using SQL. The text generated is passed as Title Attribute in HTML. There needs to be some newline characters generated in the tool tip. I have used the following - &#10; CHAR(13); CHAR(10); <br>; \n. However in all cases, I see the character itself in HTML and not a new line. Any idea how to achieve this?

the SQL is something like this

   (SELECT
      STUFF(';' + WOR.OrderNo + ' - ' + P.ProductNo + ' - ' + CAST(CAST(ROUND(WOR.OrderQuantity , 0) as int) as varchar(20)) + '; <br/> ', 1, 1, '') 
       FROM
          [ORDER] WOR 
          JOIN
             PRODUCT P 
             ON P.ID = WOR.ProductID 
          JOIN
             PRODUCT_GROUP PGR 
             ON P.ID = PGR.ProductID FOR XML PATH(''),TYPE).value('.','nvarchar(MAX)')```

And the Tootip that I see is the following

```SMU_100000021 - A-WHEL-001 - 100;<br/>SMU_100000023 - A-WHEL-001 - 90;<br/>```

Upvotes: 0

Views: 88

Answers (1)

Sabyasachi Mukherjee
Sabyasachi Mukherjee

Reputation: 303

The CHAR(10) did the trick.

(SELECT
      STUFF(';' + WOR.OrderNo + ' - ' + P.ProductNo + ' - ' + CAST(CAST(ROUND(WOR.OrderQuantity , 0) as int) as varchar(20))  +' '+ CHAR(10) + ' ', 1, 1, '') 
       FROM
          [ORDER] WOR 
          JOIN
             PRODUCT P 
             ON P.ID = WOR.ProductID 
          JOIN
             PRODUCT_GROUP PGR 
             ON P.ID = PGR.ProductID FOR XML PATH(''),TYPE).value('.','nvarchar(MAX)')

Upvotes: 0

Related Questions