Hi Thanks for ur response...
I put my entire application code below With ajax tool kit control
<ajaxToolkit:CascadingDropDown id="BL1" runat="server"></ajaxToolkit:CascadingDropDown>
in TestControl.ascx file it shows the following error
Error executing child request for handler 'System.Web.UI.Page'
without that ajax control it works fine calls the method and loads usercontrol and it displays current date and time...
Pls provide me a solution for this issue....
Thanks in advance...
Regards
Saravanan K
My WebMethods aspx page
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="WebMethods.aspx.cs" Inherits="_WebMethods" %>
<%
@ Import Namespace="System.Web.Services"%><%@ Register Src="UCTestemunhos.ascx" TagName="UCTestemunhos" TagPrefix="uc1" %>
<!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>Test PageMethods</title> </head>
<
body>
<form id="form1" runat="server">
<asp:ScriptManager ID="manager" runat="server" EnablePageMethods="True">
</asp:ScriptManager>
<div>
<uc1:UCTestemunhos ID="UCTestemunhos1" runat="server" />
</div><div id="divtable" runat="server">
</div></form>
</
body>
</
html>
My WebMethods.aspx.cs page
using
System;
using
System.Data;
using
System.Configuration;
using
System.Collections;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Web.Services;
using
System.Web.Mail;
using
System.IO;using System.Text;
public
partial class _WebMethods : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
[System.Web.Services.WebMethod]public static string SendForm(string name)
{
if (string.IsNullOrEmpty(name))
{
Page pageHolder = new Page();Control ctrl = (UserControl)pageHolder.LoadControl("TestControl.ascx");
//Control CTRL = new TestControl();
pageHolder.Controls.Add(ctrl);
//StringBuilder sb = new StringBuilder();
//StringWriter sw = new StringWriter(sb);
//HtmlTextWriter htw = new HtmlTextWriter(sw);
//CTRL.RenderControl(htw);
//ctrl.RenderControl(htw);
//pageHolder.RenderControl(htw); StringWriter output = new StringWriter();
HttpContext.Current.Server.Execute(pageHolder, output, false);return output.ToString();
//return sb.ToString();
//throw new Exception("Enter name.");
}
return "";
}
}
My Usercontrol UCTestemunhos.ascx for webmethods page .ascx
<%
@ Control Language="C#" AutoEventWireup="true" CodeFile="UCTestemunhos.ascx.cs" Inherits="UCTestemunhos" %>
<
asp:ScriptManagerProxy ID="sm1" runat="server">
<Scripts>
<asp:ScriptReference Path="~/Scripts.js" /></Scripts>
</
asp:ScriptManagerProxy>
<
fieldset id="ContactFieldset"><button id="Binding" onclick="SendForm();">Client Side Binding</button>
</
fieldset>
using
System;
using
System.Collections;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
public
partial class UCTestemunhos : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
My TestControl.ascx file
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestControl.ascx.cs" Inherits="TestControl" %>
<%
@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<
hr />
Hello
<asp:Label id="worldText" runat="server" /> <asp:Label id="dateTime" runat="server"></asp:Label>
<
ajaxToolkit:CascadingDropDown id="BL1" runat="server"></ajaxToolkit:CascadingDropDown><hr />
TestControl.ascx.cs
using
System;
using
System.Collections;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.HtmlControls;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Xml.Linq;
public
partial class TestControl : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
worldText.Text = "world!";dateTime.Text = DateTime.Now.ToString();
}
}