Mar 20, 2012, 3:12 PM
Problem Calling DirectEvent
Hello
I have a problem to call DirectEvent from Dynamic Window I created. Im using 1.3
See the Code:
This is de default.aspx code:
I have a problem to call DirectEvent from Dynamic Window I created. Im using 1.3
See the Code:
This is de default.aspx code:
<form id="frmMain" runat="server">
<ext:ResourceManager ID="rsmMain" runat="server" ViewStateMode="Disabled" ScriptMode="Debug" Theme="Gray" DisableViewState="True" EnableViewState="False">
</ext:ResourceManager>
<ext:Button ID="btnNewInvoice" runat="server" Text="Create Invoice" Flat="True">
<DirectEvents>
<Click OnEvent="btnNewInvoice_Click">
</Click>
</DirectEvents>
</ext:Button>
</form>
This DirectEvent from default.aspx calls the dynamic window:protected void btnNewInvoice_Click(object sender, DirectEventArgs e)
{
controls.InvoiceNew myInoice = new controls.InvoiceNew();
myInoice.Render(this.frmMain, RenderMode.Auto);
myInoice = null;
}
This Is the InvoiceNew Partial Class (Define Control Properties):public partial class InvoiceNew : Window
{
private FormPanel formPanel;
private Button btnCreate;
public InvoiceNew()
{
this.BuildFormPanel();
this.InitLogic();
}
private void BuildFormPanel()
{
this.btnCreate = new Button
{
ID = "btnCreateNew",
Flat = true,
Text = "Create invoice",
Icon = Ext.Net.Icon.Accept
};
this.formPanel = new FormPanel
{
Region = Ext.Net.Region.Center,
LabelWidth = 100,
ButtonAlign = Alignment.Right,
MinButtonWidth = 80,
BaseCls = "x-plain",
RenderFormElement = false,
MonitorValid = true,
CustomConfig =
{
new ConfigItem("margins", "10 10 5 10", ParameterMode.Value)
},
Buttons =
{
btnCreate
}
};
this.Items.Add(this.formPanel);
}
}
This Class have the InitLogic That will have the events of the windowpublic partial class InvoiceNew
{
private void InitLogic()
{
ComponentDirectEvent CreateClick = this.btnCreate.DirectEvents.Click;
CreateClick.Event += new ComponentDirectEvent.DirectEventHandler(CreateClick_Event);
CreateClick.EventMask.Msg = "Please Wait...";
CreateClick.EventMask.MinDelay = 10;
}
void CreateClick_Event(object sender, DirectEventArgs e)
{
//Run This Code :)
}
}