Monday, March 19, 2007

Calling Server Function From JavaScript


<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
                                AutoEventWireup="false" Inherits="CallServerFun.WebForm1" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript"
<meta name="vs_targetSchema"
function Ul()
var b=document.getElementById("Bt");;
<body MS_POSITIONING="GridLayout" onunload="Ul()">
<form id="Form1" method="post" runat="server">
<button id="Bt" name="Bt" style="DISPLAY:none"
            runat="server" type="button"></button>

Code Behind

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace CallServerFun
/// Summary description for WebForm1.

public class WebForm1 : System.Web.UI.Page
protected System.Web.UI.HtmlControls.HtmlButton Bt;

private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.

private void InitializeComponent()
this.Bt.ServerClick += new System.EventHandler
this.Load += new System.EventHandler

private void Bt_ServerClick(object sender,
                             System.EventArgs e)

No comments: