This is a migrated thread and some comments may be shown as answers.

Pop up window in telerik

9 Answers 195 Views
Window
This is a migrated thread and some comments may be shown as answers.
Vitaly
Top achievements
Rank 1
Iron
Iron
Vitaly asked on 16 Aug 2012, 08:44 PM

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

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Aug 2012, 04:31 AM
Hi Vitaly,

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.
0
Vitaly
Top achievements
Rank 1
Iron
Iron
answered on 17 Aug 2012, 03:46 PM
Thanks so much for your help.
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
0
Shinu
Top achievements
Rank 2
answered on 20 Aug 2012, 05:42 AM
Hi Vitaly,

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.
0
Vitaly
Top achievements
Rank 1
Iron
Iron
answered on 20 Aug 2012, 01:57 PM
Good morning 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.

 

0
Marin Bratanov
Telerik team
answered on 21 Aug 2012, 07:49 AM
Hello Vitaly,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vitaly
Top achievements
Rank 1
Iron
Iron
answered on 22 Aug 2012, 02:51 PM
Good morning,
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.

0
Shinu
Top achievements
Rank 2
answered on 23 Aug 2012, 05:10 AM
Hi,

Try accessing the button as shown below.
JS:
var btn=document.getElementById("Button1");

Thanks,
Shinu.
0
Ratan
Top achievements
Rank 1
answered on 01 Feb 2014, 11:22 AM
I am making a PopUp window in telerik. when page upload first then  popup size is Ok aftre that if I reopen  that window then its size become small. means size become decrease when second time we open page. My code is below.

​<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>
0
Marin Bratanov
Telerik team
answered on 03 Feb 2014, 02:15 PM
Hello Ratan,

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
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Window
Asked by
Vitaly
Top achievements
Rank 1
Iron
Iron
Answers by
Shinu
Top achievements
Rank 2
Vitaly
Top achievements
Rank 1
Iron
Iron
Marin Bratanov
Telerik team
Ratan
Top achievements
Rank 1
Share this question
or