user8189
user8189

Reputation: 79

bold html string from code behind asp.net

i want the message to be in bold when it is presented in the alert box . I am using ClientScript.RegisterStartupScript to for creating javascript alert box

I tried using b tag in the string , but its not working , asp.net does not translate it into its html equivalent

Upvotes: 0

Views: 1231

Answers (6)

Curtis
Curtis

Reputation: 103348

Javascript alert() box cannot be formatted.

If you wish to format the text you should use a custom modal popup.

Live Demo: http://jsfiddle.net/FCreL/

Upvotes: 2

Vishal Suthar
Vishal Suthar

Reputation: 17193

The alert() dialog is not rendered in HTML. so better option to go with custom alert box or confirm box.

Here you go: Modal Dialog Box

Upvotes: 0

शेखर
शेखर

Reputation: 17614

You can't do it. But you can use custom Alert and Confirm boxes.

You can read about some User Interface libraries here:

http://speckyboy.com/2010/05/17/15-javascript-web-ui-libraries-frameworks-and-libraries/

Most common libraries are:

Upvotes: 0

Alex
Alex

Reputation: 8937

There is no way to change the text style in the standart alert. You might look through these links about creating DHTML popups, though I think that is far too much work to just bolden the text on an alert.

http://www.openwebware.com/products/openpopups/

http://www.subimage.com/dhtml/subModal/

http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

Upvotes: 0

Ryan McDonough
Ryan McDonough

Reputation: 10012

There is no way to change the text style in the default javascript alert box.

If you want to style an alert you would be best served by creating a 'pop up' div, in which you can put in HTML content. Something like fancybox may be better suited to your needsd.

Upvotes: 0

asifsid88
asifsid88

Reputation: 4701

You cannot change that. The alert box and confirm box.. it is as per the browser perspective. you cannot change that. Yeah you can create your own dialog box..

If you wish to create your own dialog box then you may find this interesting
jQuery UI Dialog box

Upvotes: 0

Related Questions