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>");
}
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