Cannot get TextField values.

  1. #1

    Cannot get TextField values.

    Hi all,
    I've been playing with ext.net and I've got the following issue when I'm tryed to get the TextField value on the server side:

    Markup:

    <ext:Window ID="Window1" runat="server" Closable="false" Movable="false" Height="120"
    Icon="Lock" Title="Iniciar sesión" Width="300" Padding="5" Layout="form">
    <Items>
    <ext:TextField ID="TxUser" runat="server" FieldLabel="Usuario"
    AllowBlank="false" BlankText="Required" Text="" />
    <ext:TextField ID="TxPassword" runat="server" InputType="Password"
    FieldLabel="Password" AllowBlank="false" BlankText="Required."/>
    </Items>
    <Buttons>
    <ext:Button ID="Button1" runat="server" Text="Login" Icon="Accept">
    <DirectEvents>
    <Click OnEvent="Button1_Click">
    <EventMask ShowMask="true" Msg="Checking..." MinDelay="1000" />
    </Click>
    </DirectEvents>
    </ext:Button>
    </Buttons>
    </ext:Window>

    C#:
    protected void Button1_Click(object sender, DirectEventArgs e) {
    MessageBox msg = new MessageBox();
    msg.Alert("Data", String.Format("User: {0} | Password: {1}", TxUser.Text, TxPassword.Text)).Show();
    }

    When I ran the project I get this message:
    User: | Password:

    So, my question's, How do I to get the TextField value in c# code, say, trying to authenticate over aspnet membership...

    I'll really appreciate your help,

    Regards,
  2. #2
    Your code seems to work ok for me, although it did warn that there was a resource manager missing so I assume the code is not the whole of your page.

    It's possible something else on the page is causing the problem, could you repaste the whole of the page?
  3. #3
    Hi,

    Are you sure that ASP.Net form is presented on the page?
  4. #4
    Quote Originally Posted by DougMcDonald View Post
    Your code seems to work ok for me, although it did warn that there was a resource manager missing so I assume the code is not the whole of your page.

    It's possible something else on the page is causing the problem, could you repaste the whole of the page?
    Thanks for your reply, here's the full source:

    Markup:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SisNotas._Default" %>

    <%@ 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">

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <noscript>
    <h1>Advertencia</h1>
    <h2>Este sitio web necesita javasctipt activado para su correcto funcionamiento...</h2>
    </noscript>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server"/>
    <ext:Viewport ID="Viewport1" runat="server" Layout="border">
    <Items>
    <ext:Image ID="Image1" runat="server" Region="Center" ImageUrl="Images/desktop.jpg" />
    <ext:Window ID="Window1" runat="server" Closable="false" Movable="false" Height="120"
    Icon="Lock" Title="Iniciar sesión" Width="300" Padding="5" Layout="form">
    <Items>
    <ext:TextField ID="TxUsuario" runat="server" FieldLabel="Usuario"
    AllowBlank="false" BlankText="El campo usuario es obligatorio." Text="" />
    <ext:TextField ID="TxPassword" runat="server" InputType="Password"
    FieldLabel="Password" AllowBlank="false" BlankText="El campo password es obligatorio."/>
    </Items>
    <Buttons>
    <ext:Button ID="Button1" runat="server" Text="Login" Icon="Accept">
    <DirectEvents>
    <Click OnEvent="Button1_Click">
    <EventMask ShowMask="true" Msg="Autenticando..." MinDelay="1000" />
    </Click>
    </DirectEvents>
    </ext:Button>
    </Buttons>
    </ext:Window>
    </Items>
    </ext:Viewport>
    </form>
    </body>
    </html>

    C#:
    using System;
    using Ext.Net;

    namespace SisNotas {
    public partial class _Default : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }

    protected void Button1_Click(object sender, DirectEventArgs e) {
    MessageBox msg = new MessageBox();
    msg.Alert("Data", String.Format("User: {0} | Password: {1}", TxUsuario.Text, TxPassword.Text)).Show();
    }
    }
    }

    Did I something wrong?

    Regards,
  5. #5
    I appreciate this isn't really a 'solution' but the problem appears caused by the nesting of the window inside the viewport.

    If you remove the <ext:viewport><items> and the closing </items></ext:viewport> it works as you'd expect.
  6. #6
    Thanks, It worked for me.

    Regards,

Similar Threads

  1. Get Column Values
    By peter.campbell in forum 1.x Help
    Replies: 3
    Last Post: Mar 21, 2011, 11:40 AM
  2. Getting row values which has XML in it bug?
    By lordofthexings in forum 1.x Help
    Replies: 1
    Last Post: Jun 02, 2010, 8:10 PM
  3. Get TextField Values From UserControl
    By gpcontreras in forum 1.x Help
    Replies: 2
    Last Post: Feb 01, 2010, 10:25 AM
  4. How to see the possible values that can take vtype?
    By flormariafr in forum 1.x Help
    Replies: 3
    Last Post: Jan 22, 2010, 9:44 AM
  5. Get all values of GridPanel
    By flaviodamaia in forum 1.x Help
    Replies: 2
    Last Post: Jul 20, 2009, 7:46 AM

Posting Permissions