Solved

Link Button does not always work in codebehind

Posted on 2003-11-21
2
373 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

622 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