Welcome Guest Search | Active Topics | Sign In | Register

MsgBox-CSSClass Options
Vishakha
Posted: Friday, June 25, 2010 7:40:57 AM
Rank: Member
Groups: Member

Joined: 2/5/2010
Posts: 24
Hi ,

I want to change the CSSClass of message box as runtime.
From Code behind we have achieve this through

If AlertType = 1 Then
W_Alert.ContentStyleActive.CssClass = "AlertContent AlertSucessContent"
ElseIf AlertType = 2 Then
W_Alert.ContentStyleActive.CssClass = "AlertContent AlertOtherContent"
End If

where W_Alert is the EOweb message box control.

We want to do same through JS. However we could not find the approoiate property for the same. Hence we have done some wrokaround.

JS code

function CSSChange(flag) {

var el = document.getElementById("W_Alert_msg_bd");

var p = el.parentNode;
if (flag == 1)
el.parentNode.className = "AlertContent AlertSucessContent";
if (flag == 0)
el.parentNode.className = "AlertContent MsgboxContent";
if (flag == 2)
el.parentNode.className = "AlertContent AlertOtherContent";

}

All CSS classes contains background image as the property

e.g .AlertSucessContent
{
background-image: url('../Images/ico_success.png');
background-position:10px 10px;
background-repeat:no-repeat;
}

It works perfectly.Only problem is when user clicks outside the msgbox for the first time the background image disappers or the default class gets applied instead of dynamically rendered class.
This problem occurs for the first time only i.e if mssage box appears second time on the same page CSS class does not change even after mouse click.
Problem is only for alert through JS and not thorugh code behind.

Please help in this regard.



Thanks & Regards,
Vishakha Vaidya
eo_support
Posted: Friday, June 25, 2010 1:19:30 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You will not be able to change it through JavaScript because the interface is not exposed. Your method does not work because the MsgBox automatically switches styles between Active/Inactive states. So as soon as state changes, the MsgBox will automatically reset to whatever value that were provided to it and ignore the new value you set. The only option is to set it on the server side.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.