Reconfigure causing a problem

Page 1 of 3 123 LastLast
  1. #1

    Reconfigure causing a problem

    Hi,

    I have a GridPanel on the Form. This GridPanel has a column with Editor being a DropDownField.
    The columns are created from the CodeBehind dynamically.
    Now I want to bind the Grid with new data on a DirectEvent. For this is am using
                        gridTest.Reconfigure();
    But after the Grid is reconfigured and then try to click the DropDownField i get this strange error.


    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    The control with ID 'ctl00_childPlaceHolder_ctl00_testDropDownFieldCol umn' not found

    Can you please tell what could be the issue?

    Thanks,
    Huzefa
    Last edited by huzzy143; Sep 11, 2011 at 5:55 PM.
  2. #2
    Hi,

    This error is generally thrown when attempting to set properties of a dynamically created Control during another event (PostBack/DirectEvent) which has not been re-created (added to Page) during that second event.
    Geoffrey McGill
    Founder
  3. #3
    Hi Geoffrey,

    If i don't Reconfigure my columns and just let the DirectEvent happen, then it works great.
    Which means the controls are created back in the same way as it was initially created.
    The only problem here is that the data in the grid is not refresh with the change in the Data during DirectEvent.

    When i reconfigure the grid then the Data gets refresh properly but when i try to open the DropDownField i get the above mentioned error.

    This means something strange is happening when i am calling the Reconfigure method.

    Can you please help me out as what would be happening during reconfigure.

    Regards,
    Huzefa
  4. #4
    ok, thanks for the update.

    Best advice I can give you at this point is to step through the debugger and attempt to determine which control does not exist and hopefully why.
    Geoffrey McGill
    Founder
  5. #5
    Hi Geoffrey,

    I did through the debugger and found out few clues.

    I think during reconfigure when the columns are re-created then at time the editor controls are not created properly or may be the ID is not assigned back properly.

    Just now I made the ClientIDMode to Static and the control started to work properly(though many problem as I am not using Sttic mode anywhere).

    This should give you guys some clue.

    Please solve this issue as it is very important
  6. #6
    Hi,

    I ran a few tests and unfortunately I was unable to reproduce the problem.
    Geoffrey McGill
    Founder
  7. #7
    Hi,

    I have created a small sample to demonstrate the issue that i am facing, which can be downloaded from here:
    https://rapidshare.com/files/1420829...SampleSite.rar

    In this sample you would see 3 columns
    ID, Name, Price

    When you select any Name(from Name Combo Editor) and press tab a AfterEdit DirectEvent is triggered which updates the grid data and calls Reconfigure() method on the GridPanel.
    When the AfterEdit direct event get completed and the grid data is refreshed then again when you try to select any value from the Name Column, then you will get the error is have specified in my first thread.

    I am very much stuck of this issue. Please help me eliminate this issue.

    Regards,
    Huzefa
  8. #8
    Hi Geoffrey, Vladimir, Danill

    Guys did u see the issue in the sample that i have posted.
    It is a very serious issue for me. As i am not able to refresh the grid Data after DirectEvent

    Please help me out.

    Regards,
    Huzefa
  9. #9
    Hey Guys,
    Did u guys go through the sample? I am trying to see what going on inside to no avail.
    I am getting really mad with this issue and it has stopped my tests in middle.

    Guys please have a look and point me into right direction. In case you have any doubt with the code then reply back.

    Regards,
    Huzefa
  10. #10
    Hi,

    I downloaded your sample and made the following modifications:

    1. There was an Assembly Reference to "ExtNetSampleControl". This Assembly was not included, the Project was throwing Build errors, so I removed the Assembly Reference.

    2. Within the markup, you configured <cc1:CustomNumeric> Controls. I'm assuming this "cc1" Control was in the "ExtNetSampleControl" Assembly. I removed the markup for this control as it did not appear necessary for reproducing the problem.

    3. Same with <cc1:CustomGrid>. Was not included, so I changed to <ext:GridPanel>.

    4. Removed MasterPage as it did not appear necessary for reproducing the problem.

    5. Removed CodeBehind .cs file as it did not appear necessary for reproducing the problem.

    6. Removed inner DropDownField and second inner GridPanel as it did not appear necessary for reproducing the problem.

    7. Removed call to second ".GetData2" Method, as it did not appear necessary for reproducing the problem.

    8. Removed a lot of other unnecessary code and was able to simplify your sample down to <100 lines of code, and still was able to reproduce the original JavaScript error.

    Here's the sample we're now working with.

    Example

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.GridPanel1.DirectEvents.AfterEdit.ExtraParams.Add(new Ext.Net.Parameter("ColumnName", "e.field", ParameterMode.Raw));
                this.BindData();
            }
            
            this.GridPanel1.DirectEvents.AfterEdit.Event += GridPanel1_AfterEdit;
        }
    
        protected void GridPanel1_AfterEdit(object sender, DirectEventArgs e)
        {
            if (e.ExtraParams["ColumnName"] == "Name")
            {
                this.BindData();
                
                this.GridPanel1.RefreshView();
                this.GridPanel1.Reconfigure();
            }
        }
    
        private void BindData()
        {
            this.GridPanel1.Store.Primary.DataSource = this.GetData();
            this.GridPanel1.Store.Primary.DataBind();
        }
    
        private List<Company> GetData()
        {
            return new List<Company> 
            {
                new Company { ID = 1, Name = "3m Co" },
                new Company { ID = 2, Name = "Alcoa Inc" },
                new Company { ID = 3, Name = "Altria Group Inc" },
                new Company { ID = 4, Name = "American Express Company" },
                new Company { ID = 5, Name = "American International Group, Inc." },
                new Company { ID = 6, Name = "AT&T Inc." },
                new Company { ID = 7, Name = "Boeing Co." },
                new Company { ID = 8, Name = "Caterpillar Inc." },
                new Company { ID = 9, Name = "Citigroup, Inc." },
                new Company { ID = 10, Name = "E.I. du Pont de Nemours and Company" },
            };
        }
    
        public class Company
        {
            public int ID { get; set; }
            public string Name { get; set; }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html>
    <head runat="server">
        <title>Ext.NET Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:GridPanel 
                ID="GridPanel1" 
                runat="server" 
                Title="Example"
                Height="500" 
                Width="600" 
                AutoExpandColumn="Name">
                <Store>
                    <ext:Store runat="server">
                        <Reader>
                            <ext:JsonReader IDProperty="ID">
                                <Fields>
                                    <ext:RecordField Name="ID" Type="Int" />
                                    <ext:RecordField Name="Name" />
                                </Fields>
                            </ext:JsonReader>
                        </Reader>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column Header="ID" DataIndex="ID" Editable="false" />
                        <ext:Column Header="Name" DataIndex="Name">
                            <Editor>
                                <ext:TextField runat="server" />
                            </Editor>
                        </ext:Column>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
    At this point we now have a clean and simplified .aspx code sample which concisely and consistently reproduces the problem. We should be able to follow-up with the solution/fix shortly.
    Last edited by geoffrey.mcgill; Sep 18, 2011 at 3:24 PM.
    Geoffrey McGill
    Founder
Page 1 of 3 123 LastLast

Similar Threads

  1. Ext.net 2.0 RC2 + grid.reconfigure
    By Zdenek in forum 2.x Help
    Replies: 0
    Last Post: Jul 14, 2012, 2:36 PM
  2. [CLOSED] Problem when calling reconfigure for gridpanel using borderlayout
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 05, 2011, 1:26 PM
  3. Multiselect causing problem in Updatepanel
    By rajputamit in forum 1.x Help
    Replies: 0
    Last Post: Nov 25, 2010, 4:35 AM
  4. Replies: 0
    Last Post: Aug 17, 2010, 5:20 PM
  5. [CLOSED] Problem with grid panel property Reconfigure?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Oct 28, 2009, 10:45 AM

Posting Permissions