Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7065731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:59:31+00:00 2026-05-28T04:59:31+00:00

I try to use your example to dynamically add/remove editor and get this error:

  • 0

I try to use your example to dynamically add/remove editor and get this error:
this.field.msgTarget is null or not an object error. I’m new to the ext.net – could somebody help me?
Thanks,
Jenny

this is my code:
EditExample.aspx:

   <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditExample.aspx.cs"        Inherits="myApp.EditExample" %>

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

  <html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
  <title></title>
  <script type="text/javascript">
      var setEditor = function (e) {
         var column = e.grid.getColumnModel().columns[e.column],
         ed = column.getCellEditor(e.row);
         if (ed && (e.value != null || e.value != '')) {
            ed.destroy();
         }
         else {
            column.setEditor(new Ext.form.TextField());
         }
     }
 </script>

 </head>
 <body>
 <form id="form1" runat="server">

 <ext:ResourceManager runat="server" />
 <ext:Store ID="extStore" runat="server" >
 <Reader>
    <ext:JsonReader>
    <Fields>
       <ext:RecordField Name = "Name" />
       <ext:RecordField Name = "Code" ></ext:RecordField>
       <ext:RecordField Name = "Description" ></ext:RecordField>
    </Fields>
    </ext:JsonReader>
 </Reader>
 </ext:Store>
 <div>
 <ext:GridPanel ID="extGrd" runat="server" StripeRows="true" TrackMouseOver="true"
 StoreID="extStore" Cls="x-grid-custom" 

 Height="250px" Layout="fit">
 <ColumnModel ID="cmFC" runat="server"> 
 <Columns>
    <ext:Column ColumnID="Name" DataIndex="Name" Header="Name">
    </ext:Column>
    <ext:Column ColumnID="Code" DataIndex="Code" Header="Code">
    </ext:Column>
    <ext:Column ColumnID="Description" DataIndex="Description" Header="Description"  Editable ="true" >
        <Editor>
        <ext:TextField ID="TextField1" runat="server"></ext:TextField>
        </Editor>
        </ext:Column>
   </Columns> 
</ColumnModel>
<Listeners>
    <BeforeEdit Fn="setEditor" />
    <Render Handler="this.getColumnModel().setEditable(0, true);" />
</Listeners>
<SelectionModel>
   <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true"   MoveEditorOnEnter="true"/>
</SelectionModel> 
<LoadMask ShowMask="true" />
</ext:GridPanel>
</div>

</form>
</body>
</html>

EditExample.aspx.cs

 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;

 namespace myApp
 {
     public class info
     {
        public string Name { get; set; }
        public string Code { get; set; }
        public string Description { get; set; }
     }

     public partial class EditExample : System.Web.UI.Page
     {
         protected void Page_Load( object sender, EventArgs e )
         {
            List<info> thisInfo = new List<info>();
            thisInfo.Add( new info { Code = "1", Description = "one", Name = "one Name" } );
            thisInfo.Add( new info { Code = "2", Description = "two", Name = "two Names" } );
            thisInfo.Add( new info { Code = "3", Description = "three", Name = "three Names" } );
            thisInfo.Add( new info { Code = "4", Description = "four", Name = "four Names" } );
            thisInfo.Add( new info { Code = "5", Description = "five", Name = "five Names" } );
            thisInfo.Add( new info { Code = "6", Description = "six", Name = "six Names" } );

            this.extStore.DataSource = thisInfo;
            this.extStore.DataBind();
        }
    }

EDIT:
I tried to make the field disabled and readonly.
It made the field appear disabled (greyed out), but readable.

  var setEditor = function (e) 
  { 
        var column = e.grid.getColumnModel().columns[e.column], 
                    ed = column.getCellEditor(e.row); 
        if (ed) 
        { 
            if (e.value != null && e.value != '') 
            { 
               ed.readOnly = true; ed.setDisabled(true); 
            } 
            else 
            { 
                ed.readOnly = false; ed.setDisabled(false); 
            } 
        } 
  } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:59:31+00:00Added an answer on May 28, 2026 at 4:59 am

    You can just return false to before event.

    var setEditor = function (e) {
              var column = e.grid.getColumnModel().columns[e.column],
              ed = column.getCellEditor(e.row);
              if (ed && (e.value != '')) {
                  return false;
              }
          }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error when I try to clear the cache (for example): [Doctrine\ORM\Mapping
I try to use this code for toggling text on the link: var showText=<span>Open</span>
I try to use doctest from example from http://docs.python.org/library/doctest.html But when I run python
I try to use this mapping : @Entity @Table(name=ecc.\RATE\) @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name=DISCRIMINATOR, discriminatorType= DiscriminatorType.STRING) public
I'm trying to use this tooltip plugin: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ . I can't seem to get
I know, that I am not the first one to try to use Cocoa
I try to implement basic data feed example and all I get is just:
I am having a problem with my htaccess. when I use this url www.example.com/test
I try to use the domainpeople.com API and to do I need to use
I try to use the winDBG to debug a dump file. When I run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.