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!!

有帮助吗?

解决方案

Just found the answer to this - using getRawValue() function

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

其他提示

I tested the basic scenario and it appears to work correctly.

You might need to call .format() to convert your DateField value into a nicely formatted string, but that is not required.

Here's a full sample demonstrating the scenario. Select a Date from the DateField, then click the Button. The DateField value will be copied to the TextField.

Example

<%@ 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>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top