Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 html tag

Author  Topic 

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-02-10 : 08:36:41
Hi,
There is a label control on .aspx
The text "hello" comes from database i.e.
label1.text = "hello";
Note that, I do not have permission to change the UI code.

I would like to alter the value of the field in the table to show the text as bold i.e. <strong>

To have the text displayed as highlighted i.e. bold, I manually modified the text inside the field of the table to show

<strong>hello</strong>

Is this ok?
It does not seem to work because in the label control I see:
<strong>hello</strong>
Any thoughts please?
Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-10 : 09:22:25
i think this is what you need to make it bold
<b>hello</b>
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-02-10 : 09:30:25
No, I still get <b>hello</b> displayed.
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-10 : 09:31:38
where are you adding this code?
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-02-10 : 09:43:04
in the content of the field of the table.
I onlt have access to the data and NOT the UI.
Thanks
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-02-10 : 09:44:31
why you need to store this in table? the formatting stuff like bold,highlight,... needs to be done at front end
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-02-10 : 09:50:12
Note that, I do not have permission to change the UI code.
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2009-02-10 : 09:53:51
can you please show us a snippet of the html code. is it just html or is it asp?
Go to Top of Page

arkiboys
Master Smack Fu Yak Hacker

1433 Posts

Posted - 2009-02-10 : 13:25:18
I have managed to get hold of the .aspx code
It is:

Label.Text = Server.HtmlEncode(History.History).Replace(Environment.NewLine,"<br/>");

Is this the cause of not displaying the highlighted text?

A few questions I have just thought of;

What do you think of the following please?

1)
It seems updating the value of the field by placing char(13) into the required locations of the field, does not have any effect to have a carriage return in the line.
i.e. update table1 set field1 = 'hello' + char(13) + 'there'
The result is hello there instead of:
hello
there

2)
The reason the encoding code was placed into the .aspx page is because the field data has carriage return and line feeds. So the UI shows the new lines correctly as stored in the sql server table field. Otherwise, the carriage returns in the fields do not get displayed.

Thanks
Go to Top of Page
   

- Advertisement -