Solved

Link Button does not always work in codebehind

Posted on 2003-11-21
2
358 Views
Last Modified: 2010-04-16
Hi All,

I have two Web "linkbuttons" and a label on my aspx page as follows:
<asp:LinkButton id="HomeLinkButton" runat="server">Home</asp:LinkButton>
<asp:LinkButton id="PreviousLinkButton" runat="server">Previous</asp:LinkButton>
<asp:Label id="lblResult" runat="server"></asp:Label>

In the codebehind C# page, I have them both declared properly as follows:
protected System.Web.UI.WebControls.LinkButton HomeLinkButton;
protected System.Web.UI.WebControls.LinkButton PreviousLinkButton;
protected System.Web.UI.WebControls.Label lblResult;

In the onlick events of each, i have the following:
      private void HomeLinkButton_Click(object sender, System.EventArgs e)
            {
                  lblResult.Text = "Clicked Home Link";
            }

      private void PreviousLinkButton_Click(object sender, System.EventArgs e)
            {
                  lblResult.Text = "Clicked Previous Link";
            }

When I click on the "Previous" Link, the label is updated.
When I click on the "Home" link, it is not.

Why?

I have refreshed the page and clicked in different orders. No difference.
I have even made a third function that is called from each of the onlcick events. No change.

Please tell me how to make this work?

TIA
DoughBoy
0
Comment
Question by:DoughBoy
2 Comments
 
LVL 10

Accepted Solution

by:
ptmcomp earned 50 total points
ID: 9800876
Is the event handler properly assigned? Look in the designer generated code or the property editor
0
 

Author Comment

by:DoughBoy
ID: 9811450
that was the probem.
thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now