How can i get textField value from ext.net <items> through jquery

929 Views Asked by At

I want to get the value of textField of ext.net from Jquery.Here is my code snippet

<Items>
            <ext:FormPanel ID="FormPanel1" runat="server">
                <Items>
                    <ext:TextField ID="TextField1" runat="server" FieldLabel="Name"/>
                     <ext:TextField ID="TextField2"  runat="server" FieldLabel="Email" Vtype="email"/>
                     <ext:Checkbox ID="TextField4"  runat="server" FieldLabel="Active"/>
                     <ext:NumberField ID="TextField5"  runat="server" FieldLabel="Salary"/>
                     <ext:DateField ID="TextField3"  runat="server" FieldLabel="StartDate"/>
                </Items>
            </ext:FormPanel>
        </Items>
        <Buttons>
            <ext:Button runat="server" Text="Save">
                <Listeners>
                     <Click Fn="addEmployee" />
                </Listeners>
            </ext:Button>
        </Buttons>

and here is my javascript code

<script> 
var addEmployee = function () {
        var username = document.getElementById('TextField1').value; //I need the value of text field which has id 'TextField1'
        CompanyY.Create(username, '[email protected]', new Date(1970, 1, 1), 45000, true);

    }
</script>

Please anyone help me

1

There are 1 best solutions below

1
On

Generally speaking, there is no need to use jQuery to access Ext.NET components on client side.

Each component is shared in the Ext.NET namespace which is "App" by default. A component's id is a key in the namespace.

To retrieve a TextField's value, please use the getValue method.

var value = App.TextField1.getValue();