Jan 02, 2014, 2:58 PM
[CLOSED] Adding code behind controls to form
Hi
I know that it has something to do with the adding my code behind controls to the form controls when creating them on the fly by direct method. I thought I am doing it but I still have some troubles to see everything though.
What am I doing wrong in this example? I just want to be able to control the store in the first window...
best regards and a happy new year!
I know that it has something to do with the adding my code behind controls to the form controls when creating them on the fly by direct method. I thought I am doing it but I still have some troubles to see everything though.
What am I doing wrong in this example? I just want to be able to control the store in the first window...
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
}
}
[DirectMethod]
public void createWindowOne()
{
Window win = new Window
{
ID = "wOne",
Title = "Window One",
Modal = true,
Width = 200,
Height = 200,
Items =
{
new GridPanel {
ID = "gpWONE",
Height = 100,
Store = {
new Ext.Net.Store
{
ID = "STORE1",
Model = {
new Ext.Net.Model {
Fields = { new Ext.Net.ModelField { Name = "ID", Type = Ext.Net.ModelFieldType.String } },
IDProperty = "ID"
}
}
}
},
ColumnModel = { Columns = { new Ext.Net.Column { Text = "ID", DataIndex = "ID", MenuDisabled = true, Width = 100 } } }
},
new Ext.Net.Button { Text = "Create Window Two", Handler = "App.direct.createWindowTwo();"}
}
};
this.Form.Controls.Add(win);
win.Render(this.Form);
}
[DirectMethod]
public void createWindowTwo()
{
Window win = new Window
{
ID = "wTwo",
CloseAction = Ext.Net.CloseAction.Destroy,
Title = "Window Two",
Modal = true,
Items =
{
new TextField { ID = "tfID", FieldLabel = "Insert ID", Width = 200 },
new Ext.Net.Button { ID = "btnWTWO", Text = "Get Store Count from Window One", Handler = "alert(#{STORE1}.getCount()); #{wTwo}.close();" }
}
};
this.Form.Controls.Add(win);
win.Render(this.Form);
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Button runat="server" Text="Create Window One" Handler="App.direct.createWindowOne();"></ext:Button>
</form>
</body>
</html>
thank you for any input.best regards and a happy new year!
Last edited by Daniil; Jan 08, 2014 at 2:37 PM.
Reason: [CLOSED]