[CLOSED] extending textfield

Threaded View

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

    [CLOSED] extending textfield

    Hi,

    To capitalize text entered by user, i want to extend textfield and create another control, BSTextField. Below there are two usage samples, it's working fine when the control is not in any ext.net container and it's shown as horizantal bar when it's in ext.net container like panel (At least the only difference I could notice is this).

    Can you help me about this problem?
    Regards.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Ext.Net
    {
        public class BSTextField : TextField
        {
            protected override void OnInit(EventArgs e)
            {
                Listeners.Change.Handler = "newValue = newValue.replace(/\\i/g, 'İ');this.setValue(newValue.toUpperCase());";
                base.OnInit(e);
            }
    
            public override string InstanceOf
            {
                get
                {
                    return "Ext.form.field.Text";
                }
            }
    
            public override string XType
            {
                get
                {
                    return "bstextfield";
                }
            }
    
            public override string Text
            {
                get
                {
                    return base.Text.ToUpper();
                }
                set
                {
                    base.Text = value.ToUpper();
                }
            }
    
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
            }
    
            protected override void OnDataBinding(EventArgs e)
            {
                base.OnDataBinding(e);
            }
        }
    }
    Control working fine:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_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>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <form id="form1" runat="server">
        <div>
            <ext:BSTextField ID="txt2" runat="server" />
        </div>
        </form>
    </body>
    </html>
    Control shown as a horizontal bar:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_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>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <form id="form1" runat="server">
        <div>
            <ext:Panel runat="server">
                <Items>
                    <ext:BSTextField ID="txt2" runat="server" />
                </Items>
            </ext:Panel>
        </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; Jul 02, 2014 at 8:16 AM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] Creating a control by extending the ext:TextField control
    By Shanth in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Sep 12, 2011, 2:58 PM
  2. Extending Ext.Net.TextField Control
    By David Pelaez in forum 1.x Help
    Replies: 1
    Last Post: Dec 22, 2010, 10:43 AM
  3. Extending DatePicker
    By onurbozkurt in forum 1.x Help
    Replies: 0
    Last Post: Apr 29, 2009, 8:45 AM
  4. Extending Ext Components and Coolite
    By jchau in forum Open Discussions
    Replies: 1
    Last Post: Aug 14, 2008, 11:35 AM

Posting Permissions