1. #1
    Ext User
    Join Date
    Apr 2009
    Posts
    34
    Vote Rating
    0
    KingKahn is on a distinguished road

      0  

    Default Need URGENT help with a .ashx handler, please!!

    Need URGENT help with a .ashx handler, please!!


    I have a aspx page with a single div tag called main. The js source is in another file called Main.js. I am testing this code with hard code values just to iron out communication issues between the client and the server. On my page I have 4 accordions. One of the accordions contains three text fields and a button. I have declared an anonymous handler for the button click. When the user clicks the button I want the code to call my async handler defined in a seperate.ashx file - but this never happens. The code always falls into the fail handler of the call back. What am I doing wrong over here? Thanks in advance for your time and consideration.

    Code:
        Ext.onReady(function() {
        var tabs = new Ext.TabPanel({
            renderTo: 'main',
            width: 1130,
            height: 800,
            activeTab: 0,
            frame: true,
            xtype: 'tabpanel',
            defaults: {
                autoHeight: true
            },
            items: [{
                title: 'Registration',
                // First tab panel - Registration
                layout: 'accordion',
                // Accordion object literal properties
                layoutConfig: {
                    titleCollapse: true,
                    animate: true,
                    activeOnTop: true
                },
                defaults: {
                    bodyStyle: 'padding:15px',
                    collapsed: false
                },
                items: [{ // Search accordion defs
                    title: 'LOOK UP - Search Customers',
                    layout: 'form',
                    id: 'searchForm',
                    labelWidth: 105,
                    height: 300,
                    frame: true,
                    bodyStyle: 'padding:5px',
                    autoWidth: true,
                    items: [{
                        xtype: 'fieldset',
                        title: 'Search',
                        autoHeight: true,
                        collapsible: true,
                        items: [{
                            layout: 'form',
                            defaultType: "textfield",
                            defaults: {
                                allowBlank: true
                            },
                            items: [{
                                fieldLabel: 'E-Ticket Number',
                                id: 'txtETicketNumber',
                                width: 700
                            },
                            {
                                xtype: 'button',
                                text: 'Go',
                                id: 'bntGo',
                                handler: function() {
                                    mask = new Ext.LoadMask(Ext.getBody(), {
                                        msg: "Performing Search..."
                                    });
                                    mask.show();
                                    //Ext.lib.Ajax.defaultPostHeader = 'application/json';
                                    Ext.Ajax.request({
                                        url: 'previewAttendanceInfo.ashx',
                                        method: 'GET',
                                        params: {
                                            "eventSessionId": 'M8DIL6NVROUR'
                                        },
                                        success: function(response, options) {
                                            mask.hide();
                                            Ext.MessageBox.alert(response.responseText);
                                        },
                                        failure: function(response, options) {
                                            mask.hide();
                                            Ext.MessageBox.alert('Failed', response);
                                        }
                                    });
                                }
                            },
                            {
                                fieldLabel: 'Last Name',
                                id: 'txtLastName',
                                width: 200
                            },
                            {
                                fieldLabel: 'Zip Code:',
                                id: 'txtZipCode',
                                width: 200
                            }]
                        }] // Field Defs
                    }]
                },
                {
                    title: 'Pre-Registered',
                    frame: true,
                    bodyStyle: 'padding:5px',
                    height: 300,
                    autoWidth: true
                },
                {
                    title: 'Attendance',
                    frame: true,
                    bodyStyle: 'padding:5px',
                    autoWidth: true,
                    height: 300
                },
                {
                    title: 'Purchase',
                    frame: true,
                    bodyStyle: 'padding:5px',
                    autoWidth: true,
                    height: 300
                }] // accordion items
            },
            {
                title: 'Report & Finalize'
            },
            // Second tab panel - Report & Finalize
            {
                title: 'Session Info'
            } // Third tab panel - Session Info
            ] // Main tabs end
        }).show(); // Tabs
    });
    function getETicketNumber() {
        alert('in function');
        mask.show();
        Ext.lib.Ajax.defaultPostHeader = 'application/json';
        Ext.Ajax.request({
            url: '/previewAttendanceInfo.ashx',
            method: 'POST',
            params: Ext.encode(params),
            success: function(response, options) {
                mask.hide();
                Ext.get('txtResult').dom.value = response.responseText;
                Ext.get('additionResponse').dom.innerHTML = response.responseText;
            },
            failure: function(response, options) {
                mask.hide();
                Ext.MessageBox.alert('Failed', 'Unable to add values');
            }
        });
    }

  2. #2
    Ext User
    Join Date
    Apr 2009
    Posts
    34
    Vote Rating
    0
    KingKahn is on a distinguished road

      0  

    Default NEVER MIND FOLKS - I GOT IT (Cried too soon!)

    NEVER MIND FOLKS - I GOT IT (Cried too soon!)


    Well the code may help someone at least. After I am done with this I am going to post a working example of how to call a .ashx handler from js so it may save someone else a lot of grief!

  3. #3
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Please do not place the term 'urgent' in your thread titles.

  4. #4
    Ext User wayne_o's Avatar
    Join Date
    Apr 2007
    Posts
    85
    Vote Rating
    0
    wayne_o is on a distinguished road

      0  

    Default


    If you're using VS08 you can put breakpoints in the JS code - no need of those nasty

    Code:
    alert('in function');
    dotted all over the place

    w://

  5. #5
    Sencha User
    Join Date
    Dec 2008
    Posts
    11
    Vote Rating
    0
    kora.kanchan is on a distinguished road

      0  

    Default


    i think that your handler path is not correct..
    what is the file structure of ashx,aspx and js?
    is js file called the handler?

    put the breakpoint in handler.