May 15, 2014, 3:49 PM
[CLOSED] how to add content of fieldcontainer in codebehind?
<ext:FieldContainer ID="Container1" AnchorHorizontal="100%" runat="server" FieldLabel="验证码">
<Content>
<obout:CaptchaImage ID="Captcha1" runat="server" RelativeImageUrl="false" />
<a href="javascript:$find('<%=Captcha1.ClientID %>').getNewImage();">看不清?</a>
</Content>
</ext:FieldContainer>
how to do above in codebehind?<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm44.aspx.cs" Inherits="extdemo.test.WebForm44" %>
<%@ Import Namespace="Ext.Net" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
CreateLoginWindow();
}
private void CreateLoginWindow()
{
var window = new Ext.Net.Window
{
Title = "用户登录",
ID = "w_login",
Width = 300,
Modal = true,
Closable = false,
};
var fp = new Ext.Net.FormPanel
{
Padding = 4,
Layout = LayoutType.Anchor.ToString(),
Buttons =
{
new Ext.Net.Button {Text = "取消"},
new Ext.Net.Button {Text = "登录"}
}
};
var tfName = new TextField
{
ID = "tf_uname",
FieldLabel = "用户名",
AnchorHorizontal = "100%",
Margin = 4,
LabelWidth = 60
};
var tfPass = new TextField
{
ID = "tf_pass",
FieldLabel = "密码",
AnchorHorizontal = "100%",
Margin = 4,
LabelWidth = 60
};
fp.Items.Add(tfName);
fp.Items.Add(tfPass);
var fc = new FieldContainer();
// fc.Content=
fp.Items.Add(fc);
window.Items.Add(fp);
this.Form.Controls.Add(window);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server"></ext:ResourceManager>
</form>
</body>
</html>
Last edited by Daniil; May 20, 2014 at 7:58 AM.
Reason: [CLOSED]