So this seems famous, but with little different.
JavaScript Function:
function ShowMessage(Message, Title, isAlarm) {
$("#dtext").html(Message);
$("span.ui-dialog-title").text(Title);
$("#dialog").dialog({
open: function(e) {
var Dia = $(e.target);
if (isAlarm == true) {
Dia.parents(".ui-dialog:first").find(".ui-dialog-titlebar").css("background", "red");
Dia.parents(".ui-dialog:first").find(".ui-dialog-titlebar").css("color", "White");
}
else {
Dia.parents(".ui-dialog:first").find(".ui-dialog-titlebar").css("background", "LightSeaGreen");
Dia.parents(".ui-dialog:first").find(".ui-dialog-titlebar").css("color", "White");
}
},
show: "blind",
hide: "clip",
modal: true,
resizable: false,
buttons: {
"Close": function(e) {
$(this).dialog("close");
return true;
}
}
});
}
As you see this method fill with Jquery-Code. if this is just java-script, We can use this Code to call that function but in this case this method don't work well.
C# calling JS Method:
if (!Pointer.ClientScript.IsStartupScriptRegistered("message"))
Pointer.Page.ClientScript.RegisterStartupScript
(Pointer.Master.GetType(), "message", "ShowMessage('messageBox','" + Message + "',false);", true);
I don't Know how to resolve this problem. I Want just call this Js function from server-side?
Edit 1
Thank for your attention. some guy's want from me describe my problem better. Why I can't ?
Cuz I don't know what's exactly problem
.
I just can say, I test this program with FireBug and set break-point on first line on JS function but in run time when I call that Js function that break-point Hit
for a few Millisecond and then page reload goes complete and nothing happened.
I'm newbie on JS and jQuery. So Instead hitting down vote plz try sample program with these Code's and help Me.
thank Again (specially Stefan, PirateKitten, Widor)
Edit 2
I made this Function(JQuery Message Function)
to replace Old Function
which only use simple JS alert. and I must say old version work(even if I call that from server-side with JS-Caller-Function I write).
in this case, even if I call new Function(JQ Function) with Js
in page like :
<button type="button" onclick="ShowMessage('hi','title',false)">
Display Message
</button>
It's worked, But when call that from server side, Function don't work
.