Solved

Link Button does not always work in codebehind

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

837 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