ClickOnce Button?

Discussion in 'ASP .Net' started by =?Utf-8?B?QXNhZg==?=, Sep 7, 2006.

  1. Hi,

    I have an ASP.NET 2.0 application with Master Pages and I would to make a
    WebContols.Button to be disabled on the client side when the user pressed on
    it so he will not be able to mistakably press it again before the server has
    done processing his request.

    How can it be done?

    Regards,
    Asaf
     
    =?Utf-8?B?QXNhZg==?=, Sep 7, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?QXNhZg==?=

    Hans Kesting Guest

    > Hi,
    >
    > I have an ASP.NET 2.0 application with Master Pages and I would to make a
    > WebContols.Button to be disabled on the client side when the user pressed on
    > it so he will not be able to mistakably press it again before the server has
    > done processing his request.
    >
    > How can it be done?
    >
    > Regards,
    > Asaf


    like this maybe?
    http://www.metabuilders.com/Tools/OneClick.aspx

    Hans Kesting
     
    Hans Kesting, Sep 7, 2006
    #2
    1. Advertising

  3. Hello Hans,

    Thanks for your reply but I am looking just to Disabled the button when the
    user pressed it.

    Regards,
    Asaf


    "Hans Kesting" wrote:

    > > Hi,
    > >
    > > I have an ASP.NET 2.0 application with Master Pages and I would to make a
    > > WebContols.Button to be disabled on the client side when the user pressed on
    > > it so he will not be able to mistakably press it again before the server has
    > > done processing his request.
    > >
    > > How can it be done?
    > >
    > > Regards,
    > > Asaf

    >
    > like this maybe?
    > http://www.metabuilders.com/Tools/OneClick.aspx
    >
    > Hans Kesting
    >
    >
    >
     
    =?Utf-8?B?QXNhZg==?=, Sep 7, 2006
    #3
  4. Hi,

    I understand that your webform takes long time to complete the postback and
    you want the button caused the postback gets disabled after clicked, right?

    I think you can use following code as an example:

    ----8<---- web form ----

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    Inherits="_Default" %>

    <!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 type="text/javascript" language="javascript">
    function mypostback()
    {
    form1.button1.disabled = true;
    form1.submit();
    }
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:Button ID="button1" runat="server"
    OnClientClick="mypostback();" Text="Submit" />
    </div>
    </form>
    </body>
    </html>

    ----8<---- code behind -----

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;

    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    if (IsPostBack)
    {
    System.Threading.Thread.Sleep(3000);
    }
    }
    }

    I hope this helps. Please feel free to post here if anything is unclear.

    Sincerely,
    Walter Wang (, remove 'online.')
    Microsoft Online Community Support

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.

    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.
    ==================================================

    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Walter Wang [MSFT], Sep 7, 2006
    #4
  5. Hello Walter,

    Thanks for your help.

    Regards,
    Asaf

    "Walter Wang [MSFT]" wrote:

    > Hi,
    >
    > I understand that your webform takes long time to complete the postback and
    > you want the button caused the postback gets disabled after clicked, right?
    >
    > I think you can use following code as an example:
    >
    > ----8<---- web form ----
    >
    > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
    > Inherits="_Default" %>
    >
    > <!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 type="text/javascript" language="javascript">
    > function mypostback()
    > {
    > form1.button1.disabled = true;
    > form1.submit();
    > }
    > </script>
    > </head>
    > <body>
    > <form id="form1" runat="server">
    > <div>
    > <asp:Button ID="button1" runat="server"
    > OnClientClick="mypostback();" Text="Submit" />
    > </div>
    > </form>
    > </body>
    > </html>
    >
    > ----8<---- code behind -----
    >
    > using System;
    > using System.Web.UI;
    > using System.Web.UI.WebControls;
    > using System.Web.UI.HtmlControls;
    >
    > public partial class _Default : System.Web.UI.Page
    > {
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > if (IsPostBack)
    > {
    > System.Threading.Thread.Sleep(3000);
    > }
    > }
    > }
    >
    > I hope this helps. Please feel free to post here if anything is unclear.
    >
    > Sincerely,
    > Walter Wang (, remove 'online.')
    > Microsoft Online Community Support
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    > ications.
    >
    > Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 1 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions or complex
    > project analysis and dump analysis issues. Issues of this nature are best
    > handled working with a dedicated Microsoft Support Engineer by contacting
    > Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/subscriptions/support/default.aspx.
    > ==================================================
    >
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
     
    =?Utf-8?B?QXNhZg==?=, Sep 7, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralph Sieminsky

    ClickOnce in VS 2005 Beta 1 ?

    Ralph Sieminsky, Jul 8, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    517
    Nakul Durve
    Jul 12, 2004
  2. =?Utf-8?B?RGVhc3Vu?=

    ClickOnce and Certificates ?

    =?Utf-8?B?RGVhc3Vu?=, Jan 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    594
    =?Utf-8?B?RGVhc3Vu?=
    Jan 5, 2006
  3. ad
    Replies:
    2
    Views:
    391
  4. Tina
    Replies:
    8
    Views:
    2,700
    Laurent Bugnion
    Sep 4, 2006
  5. Replies:
    2
    Views:
    2,440
    Laurent Bugnion
    Sep 18, 2006
Loading...

Share This Page