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

link open in gird

6 Answers 110 Views
Window
This is a migrated thread and some comments may be shown as answers.
surya
Top achievements
Rank 1
surya asked on 05 Nov 2008, 03:39 PM
I have used your code for Open files in new window, but I can't able to open the window. I am getting error for that.

Error: [Exception... "'Sys.WebForms.PageRequestManagerParserErrorException: 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.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '<script>window.open('.' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "<unknown>"  data: no]
My code:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.CommandName == "Open File")
{
GridDataItem item = e.Item as GridDataItem;
if (item != null)
{
string file = item["name"].Text;
try
{
file = file.Replace(
"\\", \\\\);
Response.Write(
"<script>window.open('FileList2.aspx?Address=" + file + "');</script>");
}

I checked with the direct path instead of item["name"].Text; then also I am getting the same error.
Actually my requitrement is to open that link in the same window.please help me  to open the window in both ways.
Thanks
Surya

6 Answers, 1 is accepted

Sort by
0
surya
Top achievements
Rank 1
answered on 05 Nov 2008, 05:01 PM
Now it is working fine, But I need the code for the link open in the same window.
Thanks
Surya
0
Georgi Tunev
Telerik team
answered on 10 Nov 2008, 03:17 PM
Hello surya,

Are you using RadWindow? If this is so, I suggest to simply set its NavigateUrl and VisibleOnPageLoad properties to open the RadWindow when the command is called:
RadWindow1.NavigateUrl = FileList2.aspx?Address=" + file;
RadWindow1.VisibleOnPageLoad = true;




Greetings,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
surya
Top achievements
Rank 1
answered on 13 Nov 2008, 06:11 PM
I am using regular window. Is it possible to open the link in the same window with that?
Thanks
Surya
0
Georgi Tunev
Telerik team
answered on 14 Nov 2008, 02:30 PM
Hello surya,

If by opening in the same window you mean redirecting the main page to a different URL, you can use:

window.location.href = 'http://mysite.com/FileList2.aspx?Address=" + file + "'


Regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Hans Frode
Top achievements
Rank 1
answered on 06 Mar 2009, 12:44 PM
Hi!

You said that "Now this is working fine...", what solved your problem. I have the same issue, trying to open a window but get the same message you had.

Thank,
Hans Frode
0
Fiko
Telerik team
answered on 06 Mar 2009, 03:36 PM
Hi Hans,

You cannot use Response.Write() with ASP.NET AJAX for outputting JavaScript - more information on the subject and solution of the problem can be found in the Web. For example you can check this blog post.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
surya
Top achievements
Rank 1
Answers by
surya
Top achievements
Rank 1
Georgi Tunev
Telerik team
Hans Frode
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or