Javascript error when using RenderMode Classic

2 posts, 0 answers
  1. Simon
    Simon avatar
    2 posts
    Member since:
    Apr 2013

    Posted 10 Apr 2013 Link to this post

    I am using Telerik 2013.1.220.35.

    I have a fairly basic Application Page.

    <form runat="server" ID="PageForm">
         
    <asp:ScriptManager ID="ScriptManager" runat="server" />
      
    <telerik:RadComboBox runat="server" ID="cbSubtype" EmptyMessage="Select a sub-type"
                         DataTextField="Description" DataValueField="Id"
                         AutoPostBack="True"
                         OnSelectedIndexChanged="cbSubtype_SelectedIndexChanged">
        
    </telerik:RadComboBox>
     
    <telerik:RadGrid ID="rgDocuments" runat="server" AutoGenerateColumns="False"
                     CellSpacing="0" GridLines="None" AllowPaging="True" AllowSorting="True" AllowFilteringByColumn="True"
                     OnNeedDataSource="rgDocuments_NeedDataSource">
        <MasterTableView DataKeyNames="DocumentText" Name="DocumentMaster">
            <Columns>
                <telerik:GridBoundColumn DataField="Discipline" HeaderText="[Discipline]" UniqueName="Discipline" />
                <telerik:GridHyperLinkColumn DataTextField="DocumentText" HeaderText="[Document]" DataNavigateUrlFields="DocumentUrl" UniqueName="DocumentLink" />
                <telerik:GridBoundColumn DataField="Revision" HeaderText="[Rev]" UniqueName="Revision" />
                <telerik:GridBoundColumn DataField="Date" HeaderText="[Date]" UniqueName="Date" />
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
     
    </form>

    Also, the C# part.

    public partial class StandardsTypicals : LayoutsPageBase
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                    List<ListBoxGeneralDisplay> list = new List<ListBoxGeneralDisplay>();
                    list.Add(new ListBoxGeneralDisplay() { Description = "", Id = -1 });
                    list.Add(new ListBoxGeneralDisplay() { Description = "EG - Std. Specs", Id = 0 });
                    list.Add(new ListBoxGeneralDisplay() { Description = "EF - Const. Specs", Id = 1 });
                    list.Add(new ListBoxGeneralDisplay() { Description = "DO - Typicals", Id = 2 });
      
                    cbSubtype.DataSource = list;
                    cbSubtype.DataBind();
                }
            }
      
            protected void cbSubtype_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
            {
                rgDocuments.Rebind();
            }
      
            protected void rgDocuments_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
            {
                if (cbSubtype.SelectedValue != "-1" && !string.IsNullOrEmpty(cbSubtype.SelectedValue))
                {
                    List<RadgridStandardsTypicalsDisplay> displayList = new List<RadgridStandardsTypicalsDisplay>();
                    displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue });
                    displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue });
                    displayList.Add(new RadgridStandardsTypicalsDisplay() { Discipline = "Discipline", Date = new DateTime(2013, 04, 01), DocumentText = "Document Text", DocumentUrl = "http://www.google.com", Revision = "A" + cbSubtype.SelectedValue });
                    rgDocuments.DataSource = displayList;
                }
                else
                {
                    List<RadgridStandardsTypicalsDisplay> displayList = new List<RadgridStandardsTypicalsDisplay>();
                    rgDocuments.DataSource = displayList;
                }
            }
        }

    Normally, I would expect this to work
    (In fact, it works in RenderMode Native).
    However, as soon as I try to expand the ComboBox, I get this error.


    Line: 1617
    Erreur : 'top' a la valeur Null ou n'est pas un objet.
    Translate to: 'Top' is null or not an object

    I tried to debug it.

    b.RadComboBox.prototype._getOffsetParentOffset=function(c){var j=0;
    var f=0;
    var d=a(c.offsetParent);
    if(d.css("position")!="static"){var g=d.offset();
    j=g.top; // BREAK HERE.. G is null.
    f=g.left;
    if(c.offsetParent==document.body){var i=parseInt(d.css("top"),10);
    if(!isNaN(i)){j+=i;
    }var h=parseInt(d.css("left"),10);
    if(!isNaN(h)){f+=h;
    }}}var e={top:j,left:f};
    return e;
    };

    I added a comment where it breaks. This problem is fairly bizarre. I'm pretty sure I have everything that is required. The ScriptManager is there and is in a Form tag that is runat="server". I can select an item using the text selection and it works. It just never render the items. The error also trigger if I try to resize the window (after I chose to continue after the debug).

    I hope you can guide me on the right path.
  2. Simon
    Simon avatar
    2 posts
    Member since:
    Apr 2013

    Posted 11 Apr 2013 Link to this post

    I fixed my error. My problem was that I wasn't using any MasterPage. I didn't realize this for quite a while. Because of that, I had no HTML, HEAD or BODY tags in my page. Once I added those, everything started to work perfectly.
Back to Top