1 Replies - 5141 Views - Last Post: 19 August 2011 - 01:23 PM Rate Topic: -----

#1 prvn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 14
  • Joined: 17-March 11

Event created in user control not working

Posted 08 August 2011 - 12:27 AM

//linkmenu.ascx

<%@ Control Language="C#" Au....

<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">LinkButton</asp:LinkButton>



//linkmenu.ascx.cs

........
        public EventHandler LinkClicked;
.....
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            // One of the LinkButton controls has been clicked.
            // Raise an event to the page.
            if (LinkClicked != null)
            {
                LinkClicked(this, EventArgs.Empty);
            }
        }


//wizard.aspx

<%@ Page Language="C#" Au......
<%@ Register src="linkmenu........

.......
<uc1:linkmenu ID="linkmenu1" runat="server" onLinkClicked="LinkClicked"/>



//wizard.aspx.cs
.....
        protected void LinkClicked(object sender, EventArgs e)
        {
            Label1.Text = "Click detected.";
        }




The event LinkClicked in wizard.aspx.cs is not getting hit when the user control link button is clicked can any one tell where i have done wrong.

Quote

My secretary hopes that I will pay her, her landlord hopes that she will produce some rent, the Electricity Board hopes that he will settle their bill, and so on. I find it a wonderfully optimistic way of life. [Dirk Gently]


Is This A Good Question/Topic? 0
  • +

Replies To: Event created in user control not working

#2 sam.bengtson  Icon User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 58
  • Joined: 21-February 11

Re: Event created in user control not working

Posted 19 August 2011 - 01:23 PM

My only guess would be to change your method from protected to public.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1