Note that there are some explanatory texts on larger screens.

plurals
  1. POCall Server Side method from Javascript but get errors when setting EnablePageMethods to True
    primarykey
    data
    text
    <p>I am currently adding keyboard shortcuts to our web application, so from JavaScript.</p> <p>So far, it has consisted mostly in triggering the click events of buttons already exposed in the user-interface.</p> <p>Now, I would like to add another one which redirects to another page. The new page URL needs to be generated based on elements from the source page query string. Basically, I have a date in the query string and I want to generate a new URL for the next day.</p> <p>I feel that it would be easier to do it server-side, using the DateTime methods and then Response.Redirect than simply using JavaScript.</p> <p>I've tried decorating a method using and then calling it from the Javascript. However, for WebMethods to work, I need to enable EnablePageMethods to true on the ScriptManager and when I do that, I am getting errors like this. The ScriptManager currently is in the master page, so its feature is automatically inherited to all contents pages as well.</p> <p>It basically looks like this:</p> <pre><code> &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="True" EnablePageMethods="True"&gt;&lt;/asp:ScriptManager&gt; </code></pre> <p>When I add the EnablePageMethods attribute, and then run the application, I get this ASP.Net error:</p> <p>Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. </p> <pre><code>Parser Error Message: Required attribute 'name' not found. Source Error: &lt;jsonSerialization maxJsonLength="500"&gt; &lt;converters&gt; &lt;add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/&gt; &lt;add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/&gt; &lt;add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/&gt; </code></pre> <p>I am not sure what I need to do to solve this error, so I would need to either find a way to fix this or find a workaround to execute my server-side method without relying on EnablePageMethods. I am thinking about adding an invisible button to the webpage and simulating a click to it to execute my server-side method, but that looks like a relatively unclean workaround.</p> <p>Can somebody please help / give some pointers? I am using ASP.Net in VB 2005 in NET 2.0.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload