How to fire a server side Sub after client side event?

Hi,

 How can i fire a server side event after a client side event..?
For example, just an example, i want to show a "message box" - The debugging one: MsgBox(stuffs), 
or calls any other functions which requires the clicked button's id?

I took a look on stuffs like getPostBackEventReference()... Did i in the wrong way?

Any help or quick sample would be very much appreciated!! :D

0
kingmag2001
2/2/2007 9:31:17 AM
asp.net.web-forms 93655 articles. 6 followers. Follow

1 Replies
1035 Views

Similar Articles

[PageSpeed] 39

Hi,

you can call the doPostBack (first argument is the control-Id) method, see my code snippet:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Testpage.aspx.cs" Inherits="Testpage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<!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>Untitled Page</title>
    <script>
      function ManualPostBack()
      {
        __doPostBack("btnSubmit", "");
      }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
    <div>

        <input type="button" id="clientButton" Value="Send" onclick="ManualPostBack()" />
        <br />
        <asp:Button ID="btnSubmit" runat="server" Text="Senden" OnClick="btnSubmit_Click" />
    </div>
</body>
</html>

 Codebehind:

public partial class Testpage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string test = "test";
    }
}
 Regards
Marc Andre
0
Zhou
2/2/2007 1:00:54 PM
Reply:

Web resources about - How to fire a server side Sub after client side event? - asp.net.web-forms

Server farm - Wikipedia, the free encyclopedia
A server farm or server cluster is a collection of computer servers usually maintained by an enterprise to accomplish server needs far beyond ...

Attack floods Internet root servers with 5 million queries a second
Enlarge (credit: rootservers.org ) Early last week, one of the most vital organs of the Internet anatomy came under an unusual attack. On two ...

Amazon deal: Save $85 on this Sony portable wireless server
Smartphones' memory storage gets filled so quickly these days thanks to photos, videos and more, so get yourself a handy portable wireless server ...

Facebook releases design for its souped-up A.I. server, 'Big Sur'
Facebook is releasing the hardware design for a server it uses to train artificial intelligence (A.I.) software, allowing other companies exploring ...

Applebee’s Server Returns $32,000 In Cash Family Accidentally Left On The Table
... and scored a huge tip from some abnormally generous person, and you figure the money is yours to keep. Or, if you’re like one Applebee’s server ...

Sanders’ Apology Over Data Breach Comes Six Months Faster Than Clinton’s Apology Over Private Server
Sanders’ Apology Over Data Breach Comes Six Months Faster Than Clinton’s Apology Over Private Server

Hyperscale infrastructure and server-based storage continue to drive spending in enterprise storage ...
... (ODMs) that sell directly to hyperscale datacenters. This portion of the market was up 23.4% on year to US$1.3 billion. Sales of server-based ...

Hillary Clinton's private server had two 'top secret' emails
Those concerns that Hillary Clinton's private email server had classified intel? They're apparently well-founded. Sources for Fox News and Politico ...

Rack Architecture, x86 Systems Helped Drive Q3 Server Growth
Third-quarter numbers from IDC and Gartner analysts show that the server space is growing, not only in terms of revenue but also in shipments. ...

Sources: Review affirms Clinton server emails were 'top secret,' despite department challenge
Sources: Review affirms Clinton server emails were 'top secret,' despite department challenge

Resources last updated: 12/21/2015 2:05:07 AM