Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 9th, 2006, 06:02 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 39
Thanks: 1
Thanked 0 Times in 0 Posts
Default Link Button does not work properly

Hello,

I've two LinkButtons on form. First link button updates time, second calls javascript function. Untill I click second, first works properly. As I click second, after then first does not work at all.

My code is as follows:

<%@ Page Language="C#" %>

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LinkButton1.Text = "Time: " + System.DateTime.Now.ToLongTimeString();
            LinkButton2.PostBackUrl = "javascript:SayHello();";
        }
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        LinkButton1.Text = "Time: " + System.DateTime.Now.ToLongTimeString();
    }
</script>

<html>
<head runat="server">
    <title>Untitled Page</title>
    <script type="text/javascript">
        function SayHello()
        {
            alert("Hello");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click"></asp:LinkButton>
        <asp:LinkButton ID="LinkButton2" runat="server">Say Hello</asp:LinkButton></div>
    </form>
</body>
</html>

Any idea? :)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link button in nested grids clcik doesnt work fir RaghaSM ASP.NET 2.0 Basics 1 June 26th, 2008 12:05 AM
Doesn't work properly for multiple file arguments. sbubendorf VBScript 7 September 20th, 2007 08:52 AM
Stored procedures won't work properly... eBilyboy SQL Server 2000 1 December 12th, 2005 11:25 AM
vc++2003 can't link properly. Kilka Visual C++ 1 March 15th, 2005 06:43 AM
Can't Get Percent Format to Work Properly twsinc Access VBA 2 November 19th, 2004 09:15 AM



All times are GMT -4. The time now is 07:56 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.