Good afternoon,
I have switch statement where based on the value pop up error message.This is just plain message.I want something nice looking window on the server side.
Here is my coding in .cs file:
switch
(Flagout)
{
case
"F":
ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Job issue.Please try again later.');", true);
break;
case "S":
ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('System error.Please try again later.');", true);
break;
case
"V":
ScriptManager.RegisterStartupScript(this, this.GetType(), "message", "alert('Security violation.You cannot approve this record.');", true);
break;
}
Please help me.
Thanks so much.
9 Answers, 1 is accepted
One suggestion is that you can call a RadAlert from codebehind as follows.
ASPX:
<
telerik:RadWindowManager
ID
=
"RadWindowManager1"
runat
=
"server"
>
</
telerik:RadWindowManager
>
C#:
switch
(Flagout)
{
case
"F"
:
string
scriptstring =
"radalert('Job issue.Please try again later.', 250, 80,'Information');"
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"radalert"
, scriptstring,
true
);
break
;
case
"S"
:
string
scriptstring =
"radalert('System error.Please try again later.', 250, 80,'Information');"
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"radalert"
, scriptstring,
true
);
break
;
case
"V"
:
string
scriptstring =
"radalert('Security violation.You cannot approve this record.', 250, 80,'Information');"
;
ScriptManager.RegisterStartupScript(
this
,
this
.GetType(),
"radalert"
, scriptstring,
true
);
break
;
}
Hope this helps.
Regards,
Shinu.
One more thing.I need popup confirmation window when I am getting value 'Y' that is means everything is ok.
Please help me.
Thanks so much
You can call a confirm call back function as shown below.
JS:
function
confirmCallBackFn(arg)
{
radalert(
"<strong>radconfirm</strong> your message here: <h3 style='color: #ff0000;'>"
+ arg +
"</h3>"
,
null
,
null
,
"Result"
);
}Thanks,
Shinu.
Thanks for your respond.I coded like you suggested to me but I am getting 2 confirm message.I need it one.
Here is my code in .cs file:
case "Y":
RadWindowManager1.RadConfirm(
"This action will approve the selected record. Are you sure?", "confirmCallBackFn", 300, 100, null, "Confirmation Message");
lblApprMsg.Text =
"Record has been approved successfully";
lblApprMsg.Visible =
true;
ReadAndBindCfnData();
And here is my code in aspx file:
radalert("<strong>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", null, null, "Result");
But once again in this case I am getting two messages:
1.This action will approve the selected record.Are you sure?.
2.radconfirm returned the following result:true/false.
I need just one message saying:
This action will approve the selected record.Are you sure?
And when user click "Cancel Button" it should not approve the record.
And when user click "OK Button" it should approve the record.
Thanks so much for your help.
I advise that you examine the following help article that explains how to achieve such a scenario: http://www.telerik.com/help/aspnet-ajax/window-using-radconfirm-in-server-code.html.
Greetings,
Marin Bratanov
the Telerik team
thanks so much for your respond I did postback and it is working fine but I do not really need postback.I need when user click confirm 'Yes' just do it without postback.Here is my coding in aspx page:
<
telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"
Skin="Vista" >
</telerik:RadWindowManager>
<asp:Button ID="Button1" runat="server" CssClass="buttons" Text=" " OnClick="Button1_Click" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function confirmCallbackFn(arg) {
if (arg) //the user clicked OK
{
__doPostBack(
"<%=Button1.UniqueID %>", "");
}
}
</script>
</telerik:RadCodeBlock>
And when I try to put instead of _doPostBack something like that:
$find(
"<%=Button1.UniqueID %>").click();
I am getting js error on the runtime:
Line: 204
Error: 'null' is null or not an object
Thanks so much for your help.
Vitaly.
Try accessing the button as shown below.
JS:
var
btn=document.getElementById(
"Button1"
);
Thanks,
Shinu.
<telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
ReloadOnShow="true" runat="server" Skin="Hay" EnableShadow="true" AutoSize="false"
KeepInScreenBounds="true" Behaviors="Default" MaxHeight="1000">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Default" Height="600px" Width="800px" AutoSize="false">
</telerik:RadWindow>
<telerik:RadWindow ID="RadWindow2" runat="server" Behaviors="Default" Width="540px" Height="550px" >
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
With this markup there is no reason for such behavior, yet here is what I can advise:
1) see if you set the DestroyOnClose property to true anywhere. It will remove the incance once it closes, so the next time you open it it will have the default settings (i.e., 300px by 300px size)
2) even if this is not the case, you can always use the control's client-side API to set its size (via the setSize(width, height) method) after you show it: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html, or use the additional arguments radopen() offers.
3) see if you have more than one RadWIndowManager on the page, because you may simply be opening another dialog, not the one you expect: http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-wrong-window-opened.html.
Regards,
Marin Bratanov
Telerik