View Full Version : [CLOSED] TextField.Text is empty in OnDirectClick

Feb 08, 2012, 12:53 PM

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)

End Sub


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<ext:ResourceManager ID="resManagerSGCO" runat="server" Namespace="SuperaWeb.SGCO" />
<ext:Panel runat="server" ID="panel1" Title="Test of OnDirectClick!" Layout="FitLayout" Flex="1">
<ext:Toolbar runat="server" ID="ctl61">
<ext:Button runat="server" id="btnShow" Icon="Add" Text="Show txtContextID.Text value" OnDirectClick="btnShow_Click" />
<ext:TextField runat="server" ID="txtContextID" Text="" />

Feb 08, 2012, 12:56 PM

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

Feb 08, 2012, 1:05 PM
Hi Vladimir.

You're right!

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

Thanks a lot for your help.