Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

I'm working on a custom control, a wysiwyg editor (which I'm going to give out freely on this site), and like all wysiwyg editors the actual text is stored in a hidden field. I have everything coming along nicely but my child control that a set up an event for isn't registring:

 

In a normal form:

<input id="test" runat="server" value="asdf" type="text">

If you set up a ServerChange event for that will fire when you change the value, just like on a regular TextBox control, the event is similiar for a hidden input. The problem is that I have an instance of this control in the children controls of my custom control and an event set up:

 

test = new HtmlInputText();

test.ID = "test";

test.ServerChange += new EventHandler(test_ServerChange);

Controls.Add("test");

 

but the event never fires even when a change is made...why? How can I get an object to fire an event?

Edited by bri189a
Posted
The answer is that you have to implement the INamingContainer interface is your custom control. This allows for those child controls to be unique, thus have events tied to them. It was buried deep within MSDN, but I found it!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...