[CLOSED] TextField with right buttons

  1. #1

    [CLOSED] TextField with right buttons

    Hi,

    I'm creating controls dynamically :

    I'm getting javascript error below When I have created TextField with right buttons :

    Unable to get property 'writeTo' of undefined or null reference

    Here is my code :

    Ext.Net.TextField extTextField1 = new Ext.Net.TextField();
                                            extTextField1.ID = fieldList[i].Name;
                                            extTextField1.EnableViewState = true;
    
                                            Ext.Net.Button extBtn = new Ext.Net.Button();
                                            extBtn.ID = "extbtn" + fieldList[i].Name;
                                            extBtn.Icon = Ext.Net.Icon.Add;
                                            extTextField1.RightButtonsShowMode = Ext.Net.ButtonsShowMode.Always;
                                            extTextField1.RightButtons.Add(extBtn);
    
    Form1.controls.add(extTextField1);
    Thanks,
    Vamsi
    Last edited by Daniil; Jun 08, 2015 at 10:30 AM. Reason: [CLOSED]
  2. #2
    Hello, Vamsi!

    I tried to reproduce your piece of code here adding a surrounding context that would run in your code part.

    I could run it. The problem is that no problem happened at all! Are you using SVN version or downloaded 3.0/3.1 version? Which one would be it?

    Here's the code I've come up with that is working:
    The .aspx.cs:
        public partial class _59539_rightClickIssue : System.Web.UI.Page
        {
            public class NmVl
            {
                public string Name;
                public string Value;
            }
    
            protected void Page_Load(object sender, EventArgs e)
            {
                var fieldList = new List<NmVl>();
                fieldList.Add(new NmVl { Name = "A", Value = "1" });
                fieldList.Add(new NmVl { Name = "B", Value = "2" });
                fieldList.Add(new NmVl { Name = "C", Value = "3" });
    
                for (int i = 0; i < 3; i++)
                {
                    Ext.Net.TextField extTextField1 = new Ext.Net.TextField();
                    extTextField1.ID = fieldList[i].Name;
                    extTextField1.EnableViewState = true;
    
                    Ext.Net.Button extBtn = new Ext.Net.Button();
                    extBtn.ID = "extbtn" + fieldList[i].Name;
                    extBtn.Icon = Ext.Net.Icon.Add;
                    extTextField1.RightButtonsShowMode = Ext.Net.ButtonsShowMode.Always;
                    extTextField1.RightButtons.Add(extBtn);
    
                    tfc.Add(extTextField1);
                }
            }
        }
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager runat="server" ScriptMode="Debug" SourceFormatting="true" />
            <ext:TextField runat="server" Text="I got some text here. :P" ID="TextField1" />
            <ext:Container runat="server" ID="tfc" />
        </div>
        </form>
    </body>
    </html>
    And the shown result is this:
    Click image for larger version. 

Name:	Screen Shot 2015-05-22 at 11.36.00.png 
Views:	58 
Size:	11.3 KB 
ID:	23995

    Can you show us in which context, or adapt the code above to reproduce the error you're experiencing?

    I hope we can get this sorted out soon.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi,

    I'm using svn version dated April 15.

    Unable to solve the issue.

    Please help me on this.


    Thanks,
    Vamsi.
  4. #4
    Hi,

    Please find code snippet below:

    <%@ Page Language="C#" %>
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
     
        </form>
    </body>
    </html>
    
    Panel Placeholder1 = null;
    
    Ext.Net.ResourceManager extResourceManager = null;
    
    protected void Page_Load(object sender, EventArgs e)
            {
    extResourceManager = new Ext.Net.ResourceManager();
    
    form1.Controls.Add(extResourceManager);
    
    Placeholder1 = new Panel();
    }
     protected void Click_Event(object sender, Ext.Net.DirectEventArgs e)
    {
    
    
    Ext.Net.TextField extTextField1 = new Ext.Net.TextField();
                                            extTextField1.ID = fieldList[i].Name;
                                            extTextField1.EnableViewState = true;
    
                                            Ext.Net.Button extBtn = new Ext.Net.Button();
                                            extBtn.ID = "extbtn" + fieldList[i].Name;
                                            extBtn.Icon = Ext.Net.Icon.Add;
                                            extTextField1.RightButtonsShowMode = Ext.Net.ButtonsShowMode.Always;
                                            extTextField1.RightButtons.Add(extBtn);
    Placeholder1.controls.add(extTextField1);
    }
  5. #5
    Hi,

    From your sample is not clear which Panel do you use (Ext.Net.Panel or ASP Panel)
    Please post a sample which does not require any changes from our side

    Also please see the following samples are demonstrated how dynamically create controls during direct event
    https://examples3.ext.net/#/XRender/Basic/Add_Items/
  6. #6
    Thank you Valdmir,


    I'm using AspPanel but I can't replace to Ext:panel.

    We have already base layout and we are replacing aspcontols to extcontrols.

    Please give me solution with out replacing the asp:panel.

    Thanks,
    Vamsi.
  7. #7
    Please post a sample which does not require any changes from our side
    Yes, please provide a runnable test case. You can put the code behind directly into the .aspx page wrapping in
    <script runat="server">
        // code behind
    </script>
    Please see Example (Very Helpful) here:
    Forum Guidelines For Posting New Topics

Similar Threads

  1. Replies: 5
    Last Post: Aug 16, 2013, 2:40 PM
  2. [CLOSED] TextField next to a Button declared in Buttons section
    By jeybonnet in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 29, 2011, 7:31 AM
  3. [CLOSED] [1.0] Spinner buttons on normal TextField?
    By danielg in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Sep 22, 2010, 2:36 PM
  4. [CLOSED] [1.0] Radio buttons that appear as buttons
    By MP in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 24, 2010, 6:28 PM
  5. Image buttons / Custom built buttons
    By conman in forum 1.x Help
    Replies: 2
    Last Post: Jul 15, 2008, 11:01 AM

Posting Permissions