70-515 · Question #172
You are debugging an ASP.NET web page. The page includes the following method: [WebMethod] public string GetServerString() { ... } The page also includes the following markup: <asp:ScriptManager…
The correct answer is A. Set the EnablePageMethods property of the ScriptManager control to true. D. Declare the GetServerString method as static. See the full explanation below for the reasoning.
Question
You are debugging an ASP.NET web page. The page includes the following method:
[WebMethod] public string GetServerString() { ... } The page also includes the following markup:
<asp:ScriptManager ID="sm1" runat="server" /> The following JavaScript code is used to call the GetServerString method:
function GetString() { PageMethods.GetServerString(callbackMethod); } function callbackMethod(str) { ... } The AJAX calls to the GetServerString method are failing. You need to ensure that the AJAX call to the GetServerString method succeeds. Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)
Options
- ASet the EnablePageMethods property of the ScriptManager control to true.
- BSet the EnablePartialRendering property of the ScriptManager control to true.
- CChange the WebMethod attribute of the GetServerString method to WebMethod
- DDeclare the GetServerString method as static.
How the community answered
(52 responses)- A79% (41)
- B13% (7)
- C8% (4)
Community Discussion
No community discussion yet for this question.