PC Review


Reply
Thread Tools Rate Thread

disable a button until a link is clicked

 
 
Betty
Guest
Posts: n/a
 
      26th Jul 2010
Hi,

If I want a button non-clickable until a link above the button is
clicked(i.e., an legal informational page is viewed then a user can go on to
the next page by clicking the button), how can I implement it?

thanks,
--
Betty
 
Reply With Quote
 
 
 
 
mick0987b
Guest
Posts: n/a
 
      26th Jul 2010
This any good for you?


<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Response.Redirect("nextpage.aspx")
End Sub

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Button1.Enabled = True
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:LinkButton ID="LinkButton1" runat="server"
onclick="LinkButton1_Click">This is the link, click this first</
asp:LinkButton>

</div>
<asp:Button ID="Button1" runat="server" Enabled="False"
onclick="Button1_Click"
Text="Button" />
</form>
</body>
</html>
 
Reply With Quote
 
Betty
Guest
Posts: n/a
 
      27th Jul 2010
Hi Mick,

Thanks for the post. It's very helpful.
--
Betty


"mick0987b" wrote:

> This any good for you?
>
>
> <%@ Page Language="VB" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <script runat="server">
>
> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> Response.Redirect("nextpage.aspx")
> End Sub
>
> Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> Button1.Enabled = True
> End Sub
> </script>
>
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head runat="server">
> <title></title>
> </head>
> <body>
> <form id="form1" runat="server">
> <div>
>
> <asp:LinkButton ID="LinkButton1" runat="server"
> onclick="LinkButton1_Click">This is the link, click this first</
> asp:LinkButton>
>
> </div>
> <asp:Button ID="Button1" runat="server" Enabled="False"
> onclick="Button1_Click"
> Text="Button" />
> </form>
> </body>
> </html>
> .
>

 
Reply With Quote
 
Cubaman
Guest
Posts: n/a
 
      28th Jul 2010
On Jul 26, 9:05*pm, Betty <be...@newsgroup.nospam> wrote:
> Hi,
>
> If I want a button non-clickable until a link above the button is
> clicked(i.e., an legal informational page is viewed then a user can go onto
> the next page by clicking the button), how can I implement it?
>
> thanks,
> --
> Betty


You can also achieve the same result using javascript, avoiding
postback an improving user experience.

On link click:

ClientScript.RegisterStartupScript(this, "document.getElementById('" +
Button1.ClientId + "').enabled = true;", true);

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable submit button once it is clicked. zlf Microsoft ASP .NET 7 3rd Feb 2008 01:13 PM
Dynamic Link button error when clicked Matt Microsoft ASP .NET 5 5th Apr 2007 03:33 AM
How do I disable a button after its clicked? =?Utf-8?B?U3RldmVu?= Microsoft ASP .NET 1 19th Jul 2004 07:39 PM
Click on a link and a picture loads in cell depending on which link you have clicked gatesheadthunde Microsoft Excel Discussion 7 13th Jun 2004 03:19 PM
IE changes the font size back to previous size when a link or button is clicked. Michael Kuntscher Windows XP Internet Explorer 1 29th May 2004 01:54 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:04 PM.