<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebForm1" %>
<%@ OutputCache Duration="100" Location= "Any" VaryByParam="none" %>
<%@ Register TagName="ABC" TagPrefix="caching" Src="~/WebUserControl1.ascx" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<caching:ABC ID="timeshow" runat="server" />
<br />
<asp:Substitution runat="server"
ID="Substitution1"
MethodName="GetTime" />
<%--Current Server Time: <% Response.WriteSubstitution(newHttpResponseSubstitutionCallback(GetTime)); %>--%>
</div>
</form>
</body>
</html>
--------------------------------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
public static String GetTime(HttpContext context)
{
WebUserControl1 foo = new WebUserControl1();
return foo.abc(context);
}
-------------------------------------------------------------------------------------------------------
Usercontrol:-
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string abc(HttpContext context)
{
string value = string.Empty; ;
try
{
value = Convert.ToString(DateTime.Now) + "sourabh";
}
catch (Exception ex)
{ }
return value;
}
}
<%@ OutputCache Duration="100" Location= "Any" VaryByParam="none" %>
<%@ Register TagName="ABC" TagPrefix="caching" Src="~/WebUserControl1.ascx" %>
<!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 runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<caching:ABC ID="timeshow" runat="server" />
<br />
<asp:Substitution runat="server"
ID="Substitution1"
MethodName="GetTime" />
<%--Current Server Time: <% Response.WriteSubstitution(newHttpResponseSubstitutionCallback(GetTime)); %>--%>
</div>
</form>
</body>
</html>
--------------------------------------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
public static String GetTime(HttpContext context)
{
WebUserControl1 foo = new WebUserControl1();
return foo.abc(context);
}
-------------------------------------------------------------------------------------------------------
Usercontrol:-
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string abc(HttpContext context)
{
string value = string.Empty; ;
try
{
value = Convert.ToString(DateTime.Now) + "sourabh";
}
catch (Exception ex)
{ }
return value;
}
}