[CLOSED] TextField.Text is empty in OnDirectClick

  1. #1

    [CLOSED] TextField.Text is empty in OnDirectClick

    Hi!

    I made a small example to explain my question!

    1 - In page_load, I set a value to text property of txtContextID control.
    2 - In btnShow_Click (called by OnDirectClick event from button btnShow) i try show the value of Text property of txtContextID. But this value return empty.

    This is a problem or am I doing something wrong?
    Thanks for any help!

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test1.aspx.vb" Inherits="WebApplication3.Test1" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <script runat="server">
    
        Protected Sub Page_Load(sender As Object, E As EventArgs) Handles Me.Load
            
            If (Not ExtNet.IsAjaxRequest) Then
                    txtContextID.Text = "12345"
            End If
                    
        End Sub
            
        Private Sub btnShow_Click(sender As Object, e As DirectEventArgs)
            Dim mb As Ext.Net.MessageBox = New Ext.Net.MessageBox
            
            mb.Alert("txtContextID.Text value!", "txtContextID.Text is: " & txtContextID.Text)
            mb.Show()
            
        End Sub
    
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="resManagerSGCO" runat="server" Namespace="SuperaWeb.SGCO" />    
        <ext:Panel runat="server" ID="panel1" Title="Test of OnDirectClick!" Layout="FitLayout" Flex="1">
            <TopBar>
                <ext:Toolbar runat="server" ID="ctl61">
                    <Items>
                        <ext:Button runat="server" id="btnShow" Icon="Add" Text="Show txtContextID.Text value" OnDirectClick="btnShow_Click" />
                    </Items>
                </ext:Toolbar>
            </TopBar>
            <Items>
                <ext:TextField runat="server" ID="txtContextID" Text="" />
            </Items>
        </ext:Panel>
    </body>
    </html>
    Last edited by Daniil; Feb 08, 2012 at 2:23 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You have no ASP.NET form therefore there is no submit of field values. Add form tag for automatic submit
  3. #3
    Hi Vladimir.

    You're right!

    I inserted the tag <form> in the aspx page and it worked correctly.

    Thanks a lot for your help.

Similar Threads

  1. always get empty value from textfield
    By robertgan in forum 1.x Help
    Replies: 1
    Last Post: Feb 09, 2012, 8:20 AM
  2. [CLOSED] NumberField zero empty text and value
    By kemalyigit in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 23, 2012, 11:30 AM
  3. [CLOSED] Validation Empty TextField
    By pdcase in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 16, 2010, 9:11 PM
  4. [CLOSED] [1.0] FileUploadField empty text
    By methode in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 10, 2009, 2:57 PM
  5. TextField.Text is allways empty
    By Puia in forum 1.x Help
    Replies: 3
    Last Post: Apr 02, 2009, 12:28 PM

Posting Permissions