Click here to Skip to main content
15,867,453 members
Articles / Web Development / IIS

Implement Script Callback Framework in ASP.NET 1.x

Rate me:
Please Sign up or sign in to vote.
4.84/5 (56 votes)
2 Aug 20048 min read 465.2K   4.2K   122  
It allows calls to server events from client script code without causing the page to post back and refresh.
<%@ Control Language="c#" AutoEventWireup="false" Codebehind="Employee.ascx.cs" Inherits="ScriptCallbackFramework.Employee" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<HTML>
	<HEAD>
		<script language="javascript">
	function ShowEmployeeDetailHandler(responseText, context) {
		if (context != null)
			context.innerHTML = responseText;
	}
	
	function ShowEmployeeErrorHandler(responseText, context) {
		alert(responseText);
		if (context != null)
			context.innerHTML = "";				
	}
		</script>
	</HEAD>
	<body>
		<P>
			<asp:Label id="Label1" runat="server" Font-Names="Arial">Please select an employee to see the his/her information</asp:Label><BR>
			<SELECT style="WIDTH: 160px" runat="server" id="employeeList">
				<OPTION selected></OPTION>
			</SELECT>
		</P>
		<P>
			<asp:Label id="LabelTitle" runat="server" Font-Names="Arial">
				<B>Employee Information</B></asp:Label>
			<br>
		</P>
		<DIV style="DISPLAY: inline; WIDTH: 100%; HEIGHT: 100%" ms_positioning="FlowLayout" runat="Server"
			id="txtEmployeeDetail"></DIV>
		<P></P>
		<P></P>
	</body>
</HTML>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Singapore Singapore
Elvin Cheng is currently living in Woodlands, Singapore. He has been developing applications with the .NET Framework, using C# and ASP.NET since October 2002. Elvin specializes in building Real-time monitoring and tracking information system for Semi-conductor manufacturing industry. During his spare time, he enjoys reading books, watching movie and gym.

Comments and Discussions