This topic is locked
[SOLVED]

Formatting ajax.setMessage

11/4/2022 10:57:14 AM
ASPRunner.NET General questions
Pete K author

Did you ever have one of those "DUH" moments? :)

Sometimes you get so used to doing things a certain way, you overlook a much easier route. For a while now, I've been annoyed at how generic and kind of out of place the text looks when you use ajax.setMessage to set some text to display after a tri-part event. I was lamenting to myself that it would be so helpful if that object were available in the Designer, so we could apply some nice styling and perhaps move it around on the page. I was thinking of even suggesting that. Then it hit me. All I have to do is wrap it in a div, give it a class, and do pretty much anything I want with CSS.

DUH!

admin 11/4/2022

Thank you for sharing, happens to all of us.

W
wshoapDevClub member 11/28/2022

Hi Pete, Can you provide an example? I was just wondering about this yesterday when working on one of my projects. Thank you.

Pete K author 12/2/2022

Something like this. In the server event, I set my display message to a string variable, "msg." Then I coded:

result["txt"] = String.Format("<div class = \"statusMsg\">{0}</div>",msg); `

In client after:

ajax.setMessage(result["txt"]);

And in custom CSS:

.statusMsg
{
padding: 20px;
color: red;
}