[CLOSED] [#1389] [4.2.0] TextField - CodeBehind problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [#1389] [4.2.0] TextField - CodeBehind problem

    Hi,

    I just start using Ext.Net Mobile Web Forms. As old Ext.Net WebForms developer, i tried to apply the same approach.

    Here an example using TextField and two buttons:

    Markup:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Mobile.WebForm1" %>
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET Mobile Example</title>
    </head>
    <body>
        <ext:ResourceManager runat="server" />
        
        <ext:Viewport ID="Viewport1" runat="server" Layout="VBoxLayout" Padding="10">
            <Items>
                <ext:FormPanel
                    ID="FormPanel1"
                    runat="server" >
                    <Items>
                        <ext:TitleBar ID="TitleBar1" runat="server" Docked="Top">
                            <Items>
                                <ext:Button ID="Button1" runat="server" Text="Get" OnClientTap="INTG.GetFormValues();" />
                                <ext:Button ID="Button2" runat="server" Text="Set" OnClientTap="INTG.SetFormValues();" />
                            </Items>
                        </ext:TitleBar>
                        <ext:FieldSet
                            ID="FieldSet1"
                            runat="server"
                            <Items>
                                <ext:TextField ID="TextField1" runat="server" Label="Title" Text="test" />
                            </Items>
                        </ext:FieldSet>
                    </Items>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
    </body>
    </html>
    CodeBehind:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net.Mobile;
    
    namespace Mobile
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            [DirectMethod(ShowMask = true)]
            public void SetFormValues()
            {
                TextField1.Text = "TESSSSSST";
            }
    
            [DirectMethod(ShowMask = true)]
            public void GetFormValues()
            {
                X.Msg.Alert("", TextField1.Text).Show();
            }
        }
    }
    The problem is that im not able to change the TextField text from codeBehind.

    Any idea?
    Last edited by fabricio.murta; Nov 02, 2016 at 4:10 AM.
  2. #2
    Hello @mhajhammami! Welcome to Ext.NET forums!

    After the page has been loaded, changing a controller's setting only has effect if you re-render the control. To change the value of an already rendered control, use its setter method, i.e. SetText("newText").

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello Fabricio and thank u for ur response.

    Sadly i cant find a SetText method attached to the TextField class.

    As an ASP.Net Server Control, TextField must have the possibility to manage its values throw codebehind, using viewstate or other techniques.

    Hope to find the way to do it, cause as mentionned, the EXT.Net mobile API concerns WebForms (so server controls).

    Regards.
  4. #4
    Hello @mhajhammami!

    Yes, sorry, the correct would be SetValue(object) but as per its signature it is not ideal. The Text property does not reflect an actual ExtJS field, so it is not straightforward placement.

    We will be reviewing this (as this probably is the case of Ext.NET -- not mobile -- text field as well).
    Fabrício Murta
    Developer & Support Expert
  5. #5
    We've just created issue #1389 on our bug tracker to report and fix this problem!
    Fabrício Murta
    Developer & Support Expert
  6. #6
    Thank u Fabricio for reactivity.

    Waiting for fix.

    Best regards.

Similar Threads

  1. [CLOSED] TextField in codebehind
    By vgvallee in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Jul 10, 2013, 8:14 PM
  2. Replies: 0
    Last Post: Aug 01, 2012, 1:20 AM
  3. Problem getting Gridfilter settings in codebehind
    By plykkegaard in forum 1.x Help
    Replies: 0
    Last Post: Nov 22, 2009, 6:22 PM
  4. Replies: 0
    Last Post: Nov 18, 2009, 1:50 PM
  5. Replies: 2
    Last Post: Jul 08, 2009, 12:37 PM

Posting Permissions