Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
Javascript error in UltraWebGrid
posted

I am using NetAdvantage for .NET 2008 Vol. 1 CLR 2.0. I am getting an javascript error occationally when a edit operation is done in the UltraWebGrid.

 

I get the following error

"Object doesn't support this property or method"

in the source.axd file in the line editor.setValue(v,false); where the editor has a value elemID -1.

Below is the function name and code where I get the error. I have indicated the error line in bold.

function igtbl_editCust(g,v,r,col,cElem)
{
    var id=col.EditorControlID,editor=col.getEditorControl();
    if(editor==null && id!=null)
    {
        if((editor=igtbl_getElementById(id))!=null)
            editor=editor.Object;
    }
    if(editor==null)
        return null;
    col.editorControl=editor;
    var elem=editor.Element;
    g._ensureValidParent(editor);
    editor.setValue(v,false);
    elem.style.zIndex=r.z;
    if (elem.tagName=="INPUT")
    {
       
        if(g.IsXHTML)
        {
           
            if (ig_csom.IsIE)
            {           
                r.x-=2;
                r.y-=2;
            }   
           
            var cStyle,eStyle;
            var wd=0,hd=0;
            if(ig_csom.IsIE)
            {
                cStyle=cElem.currentStyle;
                eStyle=elem.currentStyle;
                wd=igtbl_parseInt(cStyle.borderLeftWidth)+igtbl_parseInt(cStyle.borderRightWidth)-igtbl_parseInt(eStyle.borderLeftWidth)-igtbl_parseInt(eStyle.borderRightWidth);
                hd=igtbl_parseInt(cStyle.borderTopWidth)+igtbl_parseInt(cStyle.borderBottomWidth)-igtbl_parseInt(eStyle.borderTopWidth)-igtbl_parseInt(eStyle.borderBottomWidth);
            }
            else
            {
                cStyle=cElem.style;
                eStyle=elem.style;
                wd=igtbl_parseInt(cStyle.borderLeftWidth)+igtbl_parseInt(cStyle.borderRightWidth)-igtbl_parseInt(eStyle.borderLeftWidth)-igtbl_parseInt(eStyle.borderRightWidth);
                hd=igtbl_parseInt(cStyle.borderTopWidth)+igtbl_parseInt(cStyle.borderBottomWidth)-igtbl_parseInt(eStyle.borderTopWidth)-igtbl_parseInt(eStyle.borderBottomWidth);
            }
           
           
            if(r.w<0)r.w=1;
            if(r.h<0)r.h=1;
        }
        else
        {
           
            var frameBorderZero = (window.frameElement && window.frameElement.frameBorder == "0");
            if(ig_csom.IsIE && frameBorderZero)
            {
                r.x+=2;
                r.y+=2;
            }
           
            else if(ig_csom.IsFireFox)
            {
                r.x+=1;
                r.y+=1;
            }
        }
       
    }
    else if(ig_csom.IsIE && g.IsXHTML)
    {
        r.x--;
        r.y--;
    }
   
   
    if(ig_csom.IsFireFox && g.IsXHTML)
    {
        r.y -= g.DivElement.scrollTop;
        r.x -= g.DivElement.scrollLeft;
    }
   
    editor.setVisible(true,r.x,r.y,r.w,r.h);
    editor.webGrid=g;
    editor.addEventListener("blur",igtbl_hideEdit,g);
    editor.addEventListener("keydown",igtbl_hideEdit,g);
    elem.setAttribute("editType",4);
    g._editorCustom=editor;
    return elem;
}

The UltraWebGrid aspx code is as below which is placed inside an update panel. Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Width="100%" Height="340px" OnUpdateCell="UltraWebGrid1_UpdateCell">

                                <DisplayLayout AllowColSizingDefault="free" RowSelectorsDefault="No" RowHeightDefault="25px"

                                    Version="4.00" SelectTypeRowDefault="Single" BorderCollapseDefault="Separate"

                                    Name="UltraWebGrid1" StationaryMargins="Header" StationaryMarginsOutlookGroupBy="True"

                                    TableLayout="Fixed" CellClickActionDefault="Edit" AllowUpdateDefault="Yes" UseFixedHeaders="True">

                                                                      

                                    <ClientSideEvents AfterCellUpdateHandler="AfterCellUpdate" />

                                </DisplayLayout>

                                <Bands>

                                    <igtbl:UltraGridBand>

                                        <AddNewRow View="NotSet" Visible="NotSet">

                                        </AddNewRow>

                                    </igtbl:UltraGridBand>

                                </Bands>

                            </igtbl:UltraWebGrid>

 

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

<igtxt:WebNumericEdit ID="WebNumericEdit1" runat="server" Nullable="false">

                    </igtxt:WebNumericEdit>

                      <igtxt:WebNumericEdit ID="WebNumericEdit2" runat="server" Nullable="false">

                    </igtxt:WebNumericEdit>

 

I am setting the editor control id and type as below in the code behind Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

EditorControlID = WebNumericEdit2.ID;

.Type = ColumnType.Custom;

 I have an update cell event which updates the values of the grid based on the newly entered value. When a user enters a new value and scrolls or clicks on other cells the editor text box does not scroll with the grid and gives a floating kind of a feel. Now when the user clicks on other cells we get the JavaScript error.

This error occurs occasionally and when I do multiple operations.

Kindly let me know what is cause and how I can fix this error.

Regards,

Vikram


 

  • 120
    posted

    Hi Vikram ,

    Did you find any solution of this problem? I have same issue, if you can suggest any opinion on it.

    Thanks in advance,

    Manish Kakkar