Bonjour tout le monde,

Question sur l'attachement d'un event sur un custom contrôle. Je me suis basé sur le control checkbox

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
 
namespace Bcps.Controls
{
	public class BcpsSearchCheckboxList : System.Web.UI.WebControls.CheckBoxList
	{
		public BcpsSearchCheckboxList() { }
 
        protected override void Render(HtmlTextWriter writer)
        {
            string currentId = "";
            string currentName = "";
 
            writer.RenderBeginTag("UL");
 
            for (int i = 0; i < this.Items.Count; i++)
            {
				if (i > 0 && (i % 2 == 0))
				{
					writer.RenderEndTag();
					writer.RenderBeginTag("UL");
				}
 
                currentId = String.Concat(this.ClientID, this.ClientIDSeparator.ToString(), i);
                currentName = currentId.Replace('_', '$');
 
                writer.RenderBeginTag("LI");
 
                writer.Write(String.Format("<input id=\"{0}\" type=\"checkbox\" name=\"{1}\"", currentId, currentName));
                if (this.Items[i].Selected) writer.Write(" checked=\"checked\"");
                writer.Write(" />");
 
                writer.Write(String.Format("<label for=\"{0}\">{1}</label>", currentId, this.Items[i].Text));
                writer.RenderEndTag();
                writer.WriteLine("");
            }
            writer.RenderEndTag();
        }
	}
}
Mon souci se trouve quand j'utilise ce controle, je n'arrive pas à attraper l'event checked sur mes box. Dois je ajouter cette gestion, ou elle hérite du control windows de base?

Merci de votre aide