
sitefinitysteve
Top achievements
Rank 2
Veteran
sitefinitysteve
asked on 15 Sep 2010, 02:49 PM
Title says it all....the amount of asmx files I'm accumulating becasue I use (overuse? :) the RadXmlHttpPanel is getting a little crazy.
Can I do a quick one or two in the page with a WebMethod?
Can I do a quick one or two in the page with a WebMethod?
3 Answers, 1 is accepted
0
Accepted
Hello Steve,
Indeed this is possible, and we will document this feature as soon as we can. It is done in the following way:
For your convenience I have created a simple page demonstrating this. Here is the code:
.aspx
.cs
Regards,
Pero
the Telerik team
Indeed this is possible, and we will document this feature as soon as we can. It is done in the following way:
- Set EnablePageMethods="true" to the ScriptManager control on the page.
- Set RadXmlHttpPanel's WebMethodPath property to the path of the page containing the method in its code behind.
- Make sure the method is a static one (shared in VB).
- Make sure the method is marked as WebMethod
For your convenience I have created a simple page demonstrating this. Here is the code:
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PAGE_WebService.aspx.cs"
Inherits="Default_Callback" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function SetValue()
{
var panel = $find("<%=XmlPanel1.ClientID %>");
panel.set_value("Some Value");
}
</
script
>
</
telerik:RadScriptBlock
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
EnablePageMethods
=
"true"
>
</
asp:ScriptManager
>
<
div
>
<
input
value
=
"Set Value"
onclick
=
"SetValue(); return false;"
type
=
"button"
/>
<
telerik:RadXmlHttpPanel
ID
=
"XmlPanel1"
runat
=
"server"
EnableClientScriptEvaluation
=
"true"
WebMethodName
=
"HelloWorld"
WebMethodPath
=
"~/PAGE_WebService.aspx"
>
</
telerik:RadXmlHttpPanel
>
</
div
>
</
form
>
</
body
>
</
html
>
.cs
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.Script.Serialization;
using
System.Web.Services;
public
partial
class
Default_Callback : System.Web.UI.Page
{
[WebMethod]
public
static
string
HelloWorld()
{
return
"Hello World called at:"
+ DateTime.Now.ToString();
}
}
Regards,
Pero
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

sitefinitysteve
Top achievements
Rank 2
Veteran
answered on 17 Sep 2010, 04:33 PM
That's great news!
Now let me throw you for another loops ;)
Can it be done inside a Composite Control :D What I'm doing in my Composites right now is exposing the path as a public property and in my page pointing that at an external ASMX whos class points back to the Assembly which contains the service.
Now let me throw you for another loops ;)
Can it be done inside a Composite Control :D What I'm doing in my Composites right now is exposing the path as a public property and in my page pointing that at an external ASMX whos class points back to the Assembly which contains the service.
0
Accepted
Hello Steve,
I believe that this is not possible, because your custom composite control must inherit from System.Web.Services.WebService and System.Web.UI.WebControls.CompositeControl. This is not possible with C# and VB.NET, because they do not support multiple inheritance, which means that you cannot inherit from multiple base classes. WebService and CompositeControl are both base classes, and you can derive only one of them.
Greetings,
Pero
the Telerik team
I believe that this is not possible, because your custom composite control must inherit from System.Web.Services.WebService and System.Web.UI.WebControls.CompositeControl. This is not possible with C# and VB.NET, because they do not support multiple inheritance, which means that you cannot inherit from multiple base classes. WebService and CompositeControl are both base classes, and you can derive only one of them.
Greetings,
Pero
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items