Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Tweeted twitter.com/#!/StackSharePoint/status/601750899850117120
added 52 characters in body
Source Link
users1100
  • 3.2k
  • 7
  • 63
  • 116

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { HttpContext context = HttpContext.Current; Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Contextcontext.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Contextcontext.Response.Flush(); Contextcontext.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { HttpContext context = HttpContext.Current; Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); context.Response.Flush(); context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

deleted 20 characters in body
Source Link
users1100
  • 3.2k
  • 7
  • 63
  • 116

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Context.Response.Write("<script type='text/javascript'>window.frameElement.window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Context.Response.Write("<script type='text/javascript'>window.frameElement.window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?

Source Link
users1100
  • 3.2k
  • 7
  • 63
  • 116

Unable to close the modal dialog from c#

I have created one custom action. On clicking custom action, I am opening an application page as a modal dialog. The page will allow users to add the data of fields.

I have placed two buttons in the page, 1. Save , 2. Cancel. I want to add such a functionality that if Save is clicked then the form should be closed and the parent page should be refreshed. And if the cancel button is clicked then the page should be closed without refreshing.

I referred this MSDN Link to show the modal dialog.

My code for showing the page as modal dialog is:

var options = { url: _spPageContextInfo.webAbsoluteUrl + '/_layouts/15/xx/Pages/Page.aspx', tite: 'Edit Properties', allowMaximize: false, showClose: true, width: 800, height: 600, }; SP.UI.ModalDialog.showModalDialog(options); 

My code for closing the page without refreshing the page is:

protected void btnCancel_Click(object sender, EventArgs e) { Regex regEx = new Regex("[?&]IsDlg=1"); string currentUrl = Page.Request.RawUrl; if (regEx.IsMatch(currentUrl)) { Context.Response.Write("<script type='text/javascript'>window.frameElement.window.frameElement.commitPopup();</script>"); Context.Response.Flush(); Context.Response.End(); } } 

When I click on the cancel button I am getting the following error in the console of the browser.

Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.

What am I missing?