1

I want to get from datefield. Ext.NET 2.0 is a little bit difficult to study. This is a source of simple datefield.

<ext:DateField ID="DateField1" runat="server" 
     Vtype="daterange" FieldLabel="To" EnableKeyEvents="true" />

and I'd like to set the value on my Textbox.

myTextbox.setValue(App.MainContent_DateField1.getValue());

help!!

4

2 回答 2

2

刚刚找到了答案 - 使用getRawValue()函数

myTextbox.setValue(App.MainContent_DateField1.getRawValue());
于 2012-07-10T14:06:08.590 回答
1

我测试了基本场景,它似乎可以正常工作。

您可能需要调用.format()将您的DateField值转换为格式良好的字符串,但这不是必需的。

这是演示该场景的完整示例。Date从 中选择一个DateField,然后单击Button。该DateField值将被复制到TextField.

例子

<%@ Page Language="C#" %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>Ext.NET Example</title>
</head>
<body>
    <form runat="server">
        <ext:ResourceManager runat="server" />

        <ext:DateField ID="DateField1" runat="server" />
        <ext:TextField ID="TextField1" runat="server" />

        <ext:Button 
            runat="server" 
            Text="Submit" 
            OnClientClick="TextField1.setValue(DateField1.getValue().format('d-M-Y'));" 
            />
    </form>
</body>
</html>
于 2012-05-08T07:17:05.403 回答