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

Open RadWindow using RadAjaxManager

9 Answers 544 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Paul Bishop
Top achievements
Rank 1
Paul Bishop asked on 16 Jan 2009, 09:02 PM
Please forgive the cross-post.  I did some more tests and realized this issue seems to be more related to RadAjax than RadGrid.  I posted this yesterday on the forum for RadGrid.

I'm trying to open a RadWindow from a RadGrid in a web user control from server-side code using the RadAjaxManager in my Master Page (this is .NET 2 and VS2005).  In the ItemCommand event of my RadGrid I'm calling the following line of code:

RadAjaxManager

.GetCurrent(this.Page).ResponseScripts.Add("radopen(null,\"dlgTest\");");

The first time I run it I get the following error:

Sys.WebForms.PageRequestManagerParserErrorException: The message received From the server could not be, parsed. Common causes for this error are when the response is modiFied by calls to Response.WriteO, response filters, HttpModules, or server trace is enabled  

Details: Error parsing near 'play:none;”>/span>|<html>

<head>

'.

Every time I select a row in the grid after cancelling this message, the dialog will load but the data does not change after the first time it loads.

Does anyone have any suggestions or sample of how I could do this?  Following is a link to a test project where I've been able to reproduce the problem:

EDIT: I've updated the zip file referenced below to reflect the curernt state of this post.
  http://sites.google.com/site/pbbgso/Home/TelerikGridTest.zip?attredirects=0

Just click on one of the link buttons in the grid to get the error.  This is where I'd like to launch the window.

 

 

 

 

 

 

 

9 Answers, 1 is accepted

Sort by
0
SamJ
Top achievements
Rank 1
answered on 18 Jan 2009, 08:11 PM
Hi Paul,

Try swapping the radopen() method parameters like this:

RadAjaxManager.GetCurrent(this.Page).ResponseScripts.Add("radopen('dlgTest',null);"); 

Check out this topic:
Opening windows
0
Paul Bishop
Top achievements
Rank 1
answered on 19 Jan 2009, 03:59 AM
Thanks for your reply SamJ.  I'm afraid the syntax you suggested doesn't work.  Radopen expects the url for the window to be the first parameter and the window name to be the second one.
0
SamJ
Top achievements
Rank 1
answered on 19 Jan 2009, 06:11 AM
Hi Paul,

Yes, you are right about what each parameter is for. But note that if the second parameter is 'null', and you have RadWindowManager on the page, then new RadWindow will be open.

And on my side even this line opens new window:

RadAjaxManager1.ResponseScripts.Add("radopen('null','null')"); 

This is all the code from my test page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
        <asp:ScriptManager ID="ScriptManager1" runat="server"
        </asp:ScriptManager> 
    <div> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="Button1"
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="Button1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> 
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
        </telerik:RadWindowManager> 
    </div>         
    </form> 
</body> 
</html> 
using System; 
using System.Data; 
using System.Configuration; 
using System.Collections; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
 
public partial class Default3 : System.Web.UI.Page 
{     
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadAjaxManager1.ResponseScripts.Add("radopen('null','null')"); 
    } 

Try it and see if it works with you.





0
Paul Bishop
Top achievements
Rank 1
answered on 19 Jan 2009, 07:39 PM
After doing a lot of troubleshooting, I've been able to narrow down my problem to the line of code directly above where I try to open the window.  The line that is creating the issue is:

 

Session["EventID"] = EventID;

For some reason the RadAjaxManager doesn't like this.  In my test project I was able to get past this error by changing the line to:

 

this

.Page.Session["EventID"] = EventID;

Apparently since this is happening in a user control, I had to explicitly call the page session; otherwise, it tried to use a session object for user controls under System.Web.UI.  I made a similar change in my main project code, but it still has not fixed my problem.  At least now I know the problem has nothing to do with grids, or windows.  It is apparently something with setting a session value prior to making a call to RadAjaxManger.  Any suggestions would be greatly appreciated.

 

0
Paul Bishop
Top achievements
Rank 1
answered on 19 Jan 2009, 09:59 PM
I noticed another issue since I made my last post.  While the changes I mentioned previously get my test app past the initial error I was encountering, I noticed that subsequent calls to open the same RadWindow from the same grid gives the same window that was previously opened.  In other words, if I click the first row of my grid and have the window open displaying an EventID = 1.  Then I close the RadWindow and click the 2nd row in my grid (which should open a RadWindow displaying an EventID=2), the same window is opened as before (i.e. EventID=1).  I also tried putting a breakpoint in the Page_Load event of the aspx page I'm displaying as a RadWindow (dlg.aspx), and the breakpoint was never raised.  I'm starting to wonder if a "cached" version of the dialog page is being displayed on subsequent calls.
0
Accepted
SamJ
Top achievements
Rank 1
answered on 20 Jan 2009, 06:18 AM
Hi Paul,

I hope the last issue could be overcome by setting the ReloadOnShow property of the window to true.

I hope this helps.
0
Paul Bishop
Top achievements
Rank 1
answered on 20 Jan 2009, 01:41 PM
You're exactly right!  That did it.  This fixed my test app, now if I can just get my main app to work.  I'm still encountering an error when I try to set a value in session.  When I comment out the call to set a session variable the window opens without error.
0
Accepted
Sebastian
Telerik team
answered on 20 Jan 2009, 02:19 PM
Hello Paul,

Can you please specify what type of error you receive in this particular case? Is it possible that the error you encountered when attempting to set a value in the Session is related to the subject discussed in this blog post? Try to apply the solution explained there and let me know whether this helps.

Best regards,
Sebastian
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Paul Bishop
Top achievements
Rank 1
answered on 20 Jan 2009, 02:38 PM
That worked!  Thanks so much.  So to recap - setting the ReloadOnShow property of the RadWindow to "True" and adding a Global.asax file to my project fixed this issue.  Thanks for your help!
Tags
Ajax
Asked by
Paul Bishop
Top achievements
Rank 1
Answers by
SamJ
Top achievements
Rank 1
Paul Bishop
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or