Re: Mistake in MSDN
From: Lloyd Dupont (ld_at_NewsAccount.galador.net)
Date: 11/22/04
- Next message: Jamie Collins: "Re: Excel using ado.net - operation must use an updateable query"
- Previous message: Rakesh Rajan: "RE: Problem with asp-net apps"
- In reply to: Vivek Thakur: "Mistake in MSDN"
- Next in thread: Cowboy (Gregory A. Beamer) - MVP: "RE: Mistake in MSDN"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 22 Nov 2004 20:19:06 +1100
You can't make what you do.
Everything happens first on the client, then on the server.
When it's on the server it's too late for any client action whatsoever!
"Vivek Thakur" <Vivek Thakur@discussions.microsoft.com> wrote in message
news:C01B2F20-CF1E-4490-A1C2-0E53E886F36E@microsoft.com...
> Hello,
>
> I think I have found a mistake in MSDN.
>
> I have visual Studio 2003 with MSDN. My problem is very simple: I have a
> webform with a HTML button control as:
>
> <INPUT id="Button1" type="button" value="Button" name="Button1"
> runat="server" onclick="alert('df');">
>
> So its an HTMLServer control which does not submit.
>
> I have this code for the button in code behind:
> private void Button1_ServerClick(object sender, System.EventArgs e)
> {
> int h=0;
> h++;
> }
>
>
> Now according to MSDN: (Section: ASP.NET Server Control Event
> Model->Handling a Click Event in Client and Server Code)
>
> ***********************************************************************
> All other HTML controls (those that do not submit a form by default)
>
> Include an onclick attribute in the HTML syntax for the control, but
> follow
> it with a semicolon (;):
>
> <INPUT Type="Button" Runat="Server" Value="caption"
> onclick="clientfunction();" ...>
>
> This causes your function to be called first, before the client-side
> submit
> script is called.
>
> *************************************************************************
>
> Now in my case, its always the client side script which calls first, no
> matter what I do, even after using the semi-colon.The control still
> submits,
> but first
>
> the Javascript fires. So how can we make sure that our server side event
> is
> executed first and than the client side script
>
> runs (without using RegisterScriptBlock etc).
>
> Is the above example a mistake in MSDN??
>
> Vivek Thakur
> www.vivekthakur.com
>
>
>
- Next message: Jamie Collins: "Re: Excel using ado.net - operation must use an updateable query"
- Previous message: Rakesh Rajan: "RE: Problem with asp-net apps"
- In reply to: Vivek Thakur: "Mistake in MSDN"
- Next in thread: Cowboy (Gregory A. Beamer) - MVP: "RE: Mistake in MSDN"
- Messages sorted by: [ date ] [ thread ]