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
135
WebDataGrid jscript error in an UpdatePanel
posted

Hello,

I am getting a popup dialog that states: "Microsoft JScript runtime error: 'this._element.offsetHeight' is null or not an object".  the VS2008 debugger breaks in the infragistics function below (i have indicated the line with "<<<<<<<<" that the caused the error):

 _adjustGridLayout: function()
{
 if (this._element.offsetHeight > 0)   // <<<<<<<<<<< 'this._element' is null according to the debugger!
 {
  if (this._adjustTimerId)
  {
   clearInterval(this._adjustTimerId);
   this._adjustTimerId = null;
  }
  this._gridUtil._fireEvent(this, "InitializingLayout");
  
  var tblWidth = (this._elements.dataTbl) ? this._elements.dataTbl.offsetWidth : -1;

  this._initializeScrollbar();
  this._onResize({ "clientHeight": this._element.clientHeight }, true);

  if (this._isWidthEmpty && tblWidth > 1)
   this._element.style.width = (tblWidth + (this._vScrBar ? this._vScrBar.offsetWidth : 0)) + "px";
  //this._element.style.width = this._element.firstChild.offsetWidth + "px";

  
  if (this._elements.dataTbl)
   this._notifyBehaviorTData = new $IG.NotifySizeChangedBehavior(this._elements.dataTbl, Function.createDelegate(this, this._onDataTblResize));

  this._notifyBehavior = new $IG.NotifySizeChangedBehavior(this._element, Function.createDelegate(this, this._onResize));

  this._gridUtil._fireEvent(this, "InitializedLayout");
 }
 else
 {
  if (this._adjustTimerId == null)
   this._adjustTimerId = setInterval(Function.createDelegate(this, this._adjustGridLayout), 100);
 }
},

I spent quite a bit of time stripping down my webform page to get something minimal that duplicates the pbm.  Below is that code.  Notice that the culprit is the fact that the WebDataGrid1 is nested withing the UltraWebListbar Group <Template> and that this group is initially "collapsed" - zero height!  an UpdatePanel wraps everything as well!  if you remove the UpdatePanel, then the error no longer occurs.

to duplicate the jscript error, simply run the page and click the "Click Me" button.  this causes a partial page postback.  when the browser is processing the response, the jscript error described above occurs.  if i click "continue", then the page and datagrid appears to be rendered ok.

 I am using 2008 Volume 3 (CLR 3.5) and running IE7

Please let me know if you need any other information to help fix this issue.  I would greatly appreciate getting this resolved as this behavior is critical to the operation of our webform!

Thanks!

-chris

 

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ Register Assembly="Infragistics35.WebUI.UltraWebNavigator.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebNavigator" TagPrefix="ignav" %>
<%@ Register Assembly="Infragistics35.WebUI.UltraWebListbar.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.WebUI.UltraWebListbar" TagPrefix="iglbar" %>
<%@ Register Assembly="Infragistics35.Web.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics35.Web.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
    Namespace="Infragistics.Web.UI.LayoutControls" TagPrefix="ig" %>

<script runat="server">

    protected void Button1_Click(object sender, EventArgs e)
    {
    }

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    </asp:ScriptManager>
    <div>
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <ig:websplitter id="WebSplitter1" runat="server" enableviewstate="false"
                    height="100%" width="100%" borderstyle="None" orientation="Horizontal">
                <Panes>
                    <ig:SplitterPane Size="150px" BorderStyle="None" BorderWidth="0px" ScrollBars="Hidden">
                        <Template>
                            <asp:Button ID="button1" runat="server" Text="Click Me" OnClick="Button1_Click" />
                        </Template>
                    </ig:SplitterPane>
                    <ig:SplitterPane BorderStyle="None" BorderWidth="0px" ScrollBars="Hidden">
                        <Template>
                            <iglbar:UltraWebListbar ID="UltraWebListbar1" runat="server" EnableViewState="false"
                                Width="100%" Height="100%" BarWidth="100%" BorderStyle="None" BorderWidth="0px"
                                MergeStyles="True" ViewType="ExplorerBar" GroupSpacing="2px" GroupExpandEffect="Slide"
                                Font-Size="11pt" ItemIconStyle="Small" AllowGroupMoving="GroupSwapping" HeaderClickAction="None">
                                <Groups>
                                    <iglbar:Group Expanded="false" Text="Test group with a grid">
                                        <Template>
                                            <ig:WebDataGrid ID="WebDataGrid1" runat="server" EnableViewState="false"
                                                AutoGenerateColumns="true" DataKeyFields="ID" Width="100%" Height="100%">
                                            </ig:WebDataGrid>
                                        </Template>
                                    </iglbar:Group>
                                </Groups>
                            </iglbar:UltraWebListbar>
                        </Template>
                    </ig:SplitterPane>
                </Panes>
            </ig:websplitter>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

 

 

 

Parents
  • 14049
    Offline posted
    Aaah, it appears that the grid does not clear one of it's timers if it
    was never shown. Here is a function that would do it, you can wire it to
    before update panel post back event:
    function beforeUPRefresh()
    {
    var grid = $find("");
    if (grid._adjustTimerId)
    {
    clearInterval(grid._adjustTimerId);
    grid._adjustTimerId = null;
    }
    }
Reply Children