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

Problem calling Radalert from code

3 Answers 134 Views
Window
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Daniel asked on 14 Jan 2011, 12:15 AM
Hi. In many parts of my application when an item gets deleted I show a radalert to confirm to the user if the item has been deleted successfully or not. This has worked for me well until I needed to attach a radconfirm before the radalert. The js error that appears is "object doesn't support this property or method". This is all happening from a radtoolbar so I've followed the article here to get the radconfirm working. A regular js alert works okay.

This code has worked for me in the past.

if (rows >= 1)
{
    script = @"var oWnd = radalert('The item was deleted successfully. Click OK to redirect to the Q&A home page.', 330, 210); var browserWin = oWnd.BrowserWindow; var fn = new browserWin.Function('oWnd', 'window.location.href = ""/teams/hr/qa/""'); oWnd.add_close(fn);";
    //script = @"alert('The item was deleted successfully. Click OK to redirect to the Q&A home page.'); window.location.href = '/teams/hr/qa/';";
}
else
{
    script = @"var oWnd = radalert('An error occurred deleting the item. Please contact the ServiceDesk on x4555. Click OK to redirect to the Q&A home page.', 330, 210); var browserWin = oWnd.BrowserWindow; var fn = new browserWin.Function('oWnd', 'window.location.href = ""/teams/hr/qa/""'); oWnd.add_close(fn);";
    //script = @"alert('An error occurred deleting the item. Please contact the ServiceDesk on x4555. Click OK to redirect to the Q&A home page.');";
}
myAjaxManager.ResponseScripts.Add(script);

Thanks

Daniel

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jan 2011, 06:35 AM
Hi Daniel,


The KB Article describes better on showing radalert from code.
Calling radalert from codebehind



-Shinu.
0
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
answered on 17 Jan 2011, 07:40 AM
Thanks Shinu. Unfortunately all those methods produce the same js error. This only happens when I follow the knowlege base article above. If I use standard js functions like alert and confirm I get no errors.

Daniel
0
Svetlina Anati
Telerik team
answered on 19 Jan 2011, 04:42 PM
Hi Daniel,

 The article Shinu has pointed covers all the scenarios with opening a radalert from code-behind. In case you need further assistance, we will really need to examine your setup because if this does not work, there might be something specific in it, e.g an incorrect or missing ajax setting, etc. This being said, please prepare a sample, fully runnable reproduction demo along with detailed reproduction instructions (you can bind the grid to a fake programmatic datasource for simplicity), open a new support ticket and send it to us.

On a side note, I am glad to inform you that with the upcoming major Q1 2011 release which is scheduled for march, the RadWindowManager will provide server RadAlert, RadConfirm and RadPrompt methods which will help you easily invoke a dialog from the server without registering script and no matter ajax or RadAjax or no ajax is used.

Best wishes,

Svetlina
the Telerik team

 

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Window
Asked by
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Shinu
Top achievements
Rank 2
Daniel
Top achievements
Rank 1
Iron
Iron
Iron
Svetlina Anati
Telerik team
Share this question
or