ClickOnce Button?

G

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
 
G

Guest

Hello Hans,

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

Regards,
Asaf
 
W

Walter Wang [MSFT]

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 ([email protected], 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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top