Jun 17, 2010, 9:42 AM
[CLOSED] [1.0] DirectEvent wiring not working with code behind/dynamically created controls
Hi, I'm trying to wire events for controls that have been created in code behind and I'm finding that they do not fire. If I create the control in markup and wire the event in code everything works as expected. Is there any limitation on event wiring that I should know about before I continue?
I've included sample below incase I'm missing something obvious.
C#
protected void Page_Load(object sender, EventArgs e)
{
Ext.Net.Button b = new Ext.Net.Button();
b.ID = "myButton";
b.Text = "Button";
this.Form.Controls.Add(b);
b.Render();
b.DirectEvents.Click.Event += Button_Click;
}
private void Button_Click(object sender, DirectEventArgs e)
{
}
VBProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim b As New Ext.Net.Button
b.ID = "myButton"
b.Text = "Button"
Me.Controls.Add(b)
b.Render(Me)
AddHandler b.DirectEvents.Click.Event, AddressOf myClick
End Sub
<Ext.Net.DirectMethod()> _
Public Sub myClick(ByVal sender As Object, ByVal e As Ext.Net.DirectEventArgs)
Throw New NotImplementedException
End Sub
Any help on this would be great.Thanks,
GavinR