[CLOSED] ascx calls directmethod of another ascx

  1. #1

    [CLOSED] ascx calls directmethod of another ascx

    In my project I have (among others) 2 ascx files. Each one has an editable grid. But when I edit a cell in the grid of UsersGrid.ascx file it calls the direct method of TrialDashboard.ascx file. The problem is solved if I put an alert() with this error:
    Uncaught SyntaxError: missing ) after argument list
    in the edit() js function of TrialDashboard.ascx, just before calling its direct method. Here is the code:
    UsersGrid.ascx
    <ext:XScript ID="XScript1" runat="server">
        <script type="text/javascript">
            var edit = function (editor, e) {
                if (!(e.value === e.originalValue)) //|| (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                   #{DirectMethods}.UpdateRow(e.record.data.UserId, e.field, e.originalValue, e.value);
    
            };
    
            var Before = function (item,e) {
                //alert('e.record.data.UserId:'+e.record.data.UserId+'e.field:'+e.field+'e.originalValue:'+e.originalValue+'e.value:'+e.value);
                if ((e.column.id === 'ColUsersNotes' || e.column.id === 'ColUsersAssessment') && e.record.get('Role') != 'Investigator')
                {
                    return false;
                }
                return true;
            };
       </script>
    </ext:XScript>
    
    <ColumnModel runat="server" ID="UsersColumModel1" >
        <Columns>
           <ext:Column runat="server" ID="ColUsersEmail" DataIndex="Email" Text="Email"MinWidth="200"  Flex="2">
                                     <Editor>
                                           <ext:TextField runat="server" />
                                    </Editor>
                                </ext:Column>
        </Columns>
    </ColumnModel>
    <SelectionModel>
               <ext:CellSelectionModel runat="server" />
                </SelectionModel>
                        <Plugins>
                            <ext:CellEditing runat="server">
                                <Listeners>
                                    <BeforeEdit Handler="return Before(item, e);" />
                                    <Edit Fn="edit" />
                                </Listeners>
                            </ext:CellEditing>
                        </Plugins>
    TrialDashboard.ascx

    <ext:XScript ID="XScript1" runat="server">
        <script type="text/javascript">
            var edit = function (editor, e) {
                alert( "TD:"+e.field+ e.originalValue+ e.value e.record.data); //if alert() is here then code works as expected
    
                if (!(e.value === e.originalValue)) //|| (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                {
                    #{DirectMethods}.UpdateRo(e.record.data.id, e.record.data.Siteid, e.field, e.originalValue, e.value);
                }//#{DirectMethods}.UpdateRow(e.record.data.Siteid, e.field, e.originalValue, e.value);
    
            };
    
    
    
        </script>
    </ext:XScript>
    Last edited by fabricio.murta; May 24, 2017 at 4:52 PM.
  2. #2
    Hello @atroul!

    I hope you understand in most cases we simply can't help you if we can't run your scenario in out side. As we already discussed previously in several other posts, test case is required.

    In this case, as well, we'd require a fully runnable and simplified test case to reproduce your issue. I believe you are aware of the threads, but here goes it again: Tips for creating simplified code samples

    We want to help, but in cases like this, we just can't, for being unable to reproduce your issue on our side.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello fabricio,
    I know the rules but sometimes its not easy to give a runnable example due to dependencies etc.
    Anyway problem is solved and here is the solution:
    stackoverflow.com
  4. #4
    Hello! Thanks for understanding! Glad someone could find and help with the issue, which is luckily not really Ext.NET related (so other people could help)!.. Thanks for sharing the the answer!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 4
    Last Post: Dec 08, 2014, 1:43 PM
  2. Replies: 4
    Last Post: Dec 19, 2012, 9:58 AM
  3. ascx control
    By maxdiable in forum 1.x Help
    Replies: 0
    Last Post: Jul 07, 2009, 5:42 AM
  4. ASCX and AjaxMethod
    By Maia in forum 1.x Help
    Replies: 2
    Last Post: Mar 11, 2009, 10:06 AM
  5. Question ascx
    By heysol in forum 1.x Help
    Replies: 0
    Last Post: Feb 26, 2009, 3:48 PM

Posting Permissions