473,386 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Delegate an event in a usercontrols

ad
I have a Web User Control ClassSel;
There is a button1 in it, and I declare a delegate in it:

I drag this user control to MyWebForm, and add an event handler to the
ClassSel1.Afterclick

But it always say the Afterclick is null in run time.

How can I solve this problem?

---Web User
Control---------------------------------------------------------------------
----------------------
public delegate void _AfterClick();

public partial class ClassSel_ascx : System.Web.UI.UserControl
{
public int iYears, iClassID;
public event _AfterClick AfterClick;

protected void Button1_Click(object sender, EventArgs e)
{
....

AfterClick();
}
------MyWebForm.cs----------------------------------------------------------
-----------------
void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

ClassSel1.AfterClick += new _AfterClick(myAfterClick);
ddlSt.Visible = false;
}
else
{
ddlSt.Visible = true;
lbShow.Visible = true;
}

}
public void myAfterClick()
{
ddlSt.Visible = true;

}
Nov 17 '05 #1
0 1545

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ad | last post by:
I have a Web User Control ClassSel; There is a button1 in it, and I declare a delegate in it: I drag this user control to MyWebForm, and add an event handler to the ClassSel1.Afterclick But...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
9
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
5
by: Doug Handler | last post by:
Hi, I have a form (Form1) that contains a tab control which one tab has a customer user control (UserControl1). When the user double-clicks on the grid hosted there a new user control is...
7
by: Ant | last post by:
Hello, Very simple question but one I need clarified. Which part of the statement below is considered the 'delegate'? Is it the 'new System.EventHandler' or the btnAccept_Click? or is it...
6
by: David Veeneman | last post by:
I have several events that pass a value in their event args. One event passes an int, another a string, another a DateTime, and so on. Rather than creating a separate set of event args for each...
10
by: =?Utf-8?B?TWlrZSBNY0FsbGlzdGVy?= | last post by:
I have a partial class of a UserControl coded as follows: public partial class Login : System.Windows.Controls.UserControl { public delegate void StartingLoginHandler(string message); public...
1
by: m.bagattini | last post by:
Hello folks, I'm in trouble with an application using methodologies in subject. The idea is to have a single-page application. The host aspx page coordinates all visualizations, loading and...
22
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I have an Assembly that has various usercontrols that all implemnet an Interface The Interface public interface ISettings { bool SaveSettings();
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.