i tried simple implementation of slide control on a fresh web application and it fails to work. maybe i am missing something. thanks in advance for your assistance.
here are the steps:
1- downloaded ajax toolkit and added controls to toolbox
2- added slideshow extender control on asp.net site master page
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.ArgumentException: Unknown web method GetSlides.<br>Parameter name: methodName<br><br>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
Thanks for your reply. I read all the articles that I could follow however I had no success. I even tried creating a new C# project and use the example as is but that failed as well. So then I moved the control to default page and added the web method
to default code behind and it successfully executed. I went back to the VB project and removed the code from Site Master to Default page and that works as well. My method has been declared correctly all along, it just doesn't like placement of this control
in site master. that's the behavior i have experienced. hopefully this can help someone else.
PVT
Member
4 Points
9 Posts
SliderShowExtender not working (VB.NET)
Nov 11, 2012 03:35 PM|LINK
hi,
i tried simple implementation of slide control on a fresh web application and it fails to work. maybe i am missing something. thanks in advance for your assistance.
here are the steps:
1- downloaded ajax toolkit and added controls to toolbox
2- added slideshow extender control on asp.net site master page
<asp:SlideShowExtender ID="bannerSlider" runat="server" AutoPlay="true" Loop="true" TargetControlID="bannerImage" SlideShowServiceMethod="GetSlides" />
3- Even though there is no reference to create the "target" control, i have added the image control right after it
<asp:Image ID="bannerImage" runat="server" />
4- Added the following imports and code in code file
Imports System.Web.Services
Imports System.Web.Script.Services
<WebMethod(), ScriptMethod()> _
Public Function GetSlides() As AjaxControlToolkit.Slide()
Dim nSlides(2) As AjaxControlToolkit.Slide
nSlides(0) = New AjaxControlToolkit.Slide("images/1.png", "New", "")
nSlides(1) = New AjaxControlToolkit.Slide("images/2.png", "Old", "")
Return nSlides
End Function
5- Build and run fails with exception that a script manager needs to be on page. Added script manager.
<asp:ScriptManager ID="scriptMgr" runat="server" />
6- Build and run fails with exception
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'GetSlides' failed with the following error: <html>
<head>
<title>Unknown web method GetSlides.<br>Parameter name: methodName</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Unknown web method GetSlides.<br>Parameter name: methodName</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.ArgumentException: Unknown web method GetSlides.<br>Parameter name: methodName<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[ArgumentException: Unknown web method GetSlides.
Parameter name: methodName]
System.Web.Script.Services.WebServiceData.GetMethodData(String methodName) +536898
System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs) +213
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
</pre></code>
</td>
</tr>
</table>
<br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
</font>
</body>
</html>
<!--
[ArgumentException]: Unknown web method GetSlides.
Parameter name: methodName
at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)
at System.Web.Handlers.ScriptModule.OnPostAcquireRequestState(Object sender, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
chetan.sarod...
All-Star
65839 Points
11163 Posts
Re: SliderShowExtender not working (VB.NET)
Nov 12, 2012 04:58 AM|LINK
I think, you need to decorate your shared method with <WebMethod()> _.
So your function signature should be something like:
Similar thread - http://forums.asp.net/t/1658633.aspx/1
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
PVT
Member
4 Points
9 Posts
Re: SliderShowExtender not working (VB.NET)
Nov 18, 2012 09:48 AM|LINK
Hi Chetan,
Thanks for your reply. I read all the articles that I could follow however I had no success. I even tried creating a new C# project and use the example as is but that failed as well. So then I moved the control to default page and added the web method to default code behind and it successfully executed. I went back to the VB project and removed the code from Site Master to Default page and that works as well. My method has been declared correctly all along, it just doesn't like placement of this control in site master. that's the behavior i have experienced. hopefully this can help someone else.
Regards,
Kashif