Solved

Link Button does not always work in codebehind

Posted on 2003-11-21
2
364 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

803 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