This is a migrated thread and some comments may be shown as answers.

Script error for some users but not for others

6 Answers 90 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
James O'Brien
Top achievements
Rank 1
James O'Brien asked on 10 Nov 2010, 05:16 PM
Some users are getting the following script errors when trying to add or edit. But I'm not getting it from the server or running it in Visual Studio 2010. Please see the code below and help.

Error:

Webpage error details


User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; InfoPath.2; .NET CLR 1.1.4322; .NET4.0C; .NET4.0E; MS-RTC LM 8)

Timestamp: Wed, 10 Nov 2010 15:48:23 UTC



Message: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.

Line: 3

Char: 74672

Code: 0

URI: http://10.137.12.91/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=cphAdmin_cphCMS_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d4.1.40412.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3aen-US%3aacfc7575-cdee-46af-964f-5d85d9cdcf92%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.929.40%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a183fb741-216d-4765-9b46-4a1f5d38fdd7%3a16e4e7cd%3aed16cbdc%3a58366029%3ab7778d6c%3af7645509%3a8674cba1%3ac08e9f8a%3aa51ee93e%3a59462f1

<%@ Page Title="NextGen Portal : Home Page Quick Links" Language="C#" MasterPageFile="~/themes/CMS.master" AutoEventWireup="true" CodeFile="HomeQuickLinks.aspx.cs" Inherits="CMS_HomeQuickLinks" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphheaderCMS" Runat="Server"></asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphCMS" Runat="Server">
    <h1>Home Page Quick Link</h1>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">       
    <telerik:RadGrid
        ID="gridQL"
        runat="server"
        AutoGenerateColumns="false"
        OnItemCommand="RadGrid_ItemCommand"
        Height="300"
        OnItemDataBound="RadGrid_ItemDataBound"
        OnRowDrop="grdPendingOrders_RowDrop">
        <MasterTableView DataKeyNames="HomeQuickLinkID">
            <Columns>
                <telerik:GridBoundColumn DataField="HomeQuickLinkID" Display="false"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LinkTitle" HeaderText="Link Title"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LongShowDate" HeaderText="Show Date"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="LongUpdatedDate" HeaderText="Last Updated"></telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="UpdatedName" HeaderText="Last Updated By"></telerik:GridBoundColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Move Up" CommandName="UpQL"><ItemStyle Width="50px"></ItemStyle></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Move Down" CommandName="DownQL"><ItemStyle Width="70px"></ItemStyle></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Edit" CommandName="EditQL"></telerik:GridButtonColumn>
                <telerik:GridButtonColumn ButtonType="LinkButton" Text="Delete" CommandName="DeleteQL"></telerik:GridButtonColumn>
            </Columns>
        </MasterTableView>
        <ClientSettings EnablePostBackOnRowClick="true" AllowRowsDragDrop="false">
            <Selecting AllowRowSelect="True" UseClientSelectColumnOnly="true"/>
        </ClientSettings>
    </telerik:RadGrid>
    <br />
    <asp:HiddenField ID="hideID" runat="server" />
    <table id="entrySettings">
        <tr>
            <td class="label">Title: </td>
            <td>
                <telerik:RadTextBox
                    ID="txtLinkTitle"
                    runat="server"
                    Width="400"
                    MaxLength="400"
                    ValidationGroup="HomeQuickLink"></telerik:RadTextBox>
                <asp:RequiredFieldValidator
                    ID="RequiredLinkTitle"
                    runat="server"
                    ValidationGroup="HomeQuickLink"
                    ControlToValidate="txtLinkTitle"                       
                    ErrorMessage="Link Title can not be blank!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="label">Link: </td>
            <td>
                <telerik:RadTextBox
                    ID="txtLinkURL"
                    runat="server"
                    Width="400"
                    MaxLength="400"></telerik:RadTextBox>
                <asp:RequiredFieldValidator
                    ID="RequiredLinkURL"
                    runat="server"
                    ValidationGroup="HomeQuickLink"
                    ControlToValidate="txtLinkURL"                       
                    ErrorMessage="Link Title can not be blank!"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="label" id="FieldLabel">Show Date:</td>
            <td>
                <telerik:RadDatePicker ID="dateShowDate" runat="server"></telerik:RadDatePicker>
                <asp:RequiredFieldValidator
                    ID="RequiredShowDate"
                    runat="server"
                    ErrorMessage="Please enter the show date!"
                    ControlToValidate="dateShowDate"
                    Display="Dynamic"
                    ValidationGroup="HomeQuickLink"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="label">Created: </td>
            <td><asp:Label
                ID="lblCreated"
                runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="label">Updated: </td>
            <td><asp:Label
                ID="lblUpdated"
                runat="server"></asp:Label>
            </td>
        </tr>
    </table>
    <div style="text-align:right">
        <asp:Button
            ID="btnAdd"
            runat="server"
            Text="Add"
            ValidationGroup="HomeQuickLink"
            onclick="btnAdd_Click" />
        <asp:Button
            ID="btnUpdate"
            runat="server"
            Text="Update"
            onclick="btnUpdate_Click"
            ValidationGroup="HomeQuickLink"
            Visible="false" />
        <asp:Button
            ID="btnClear"
            runat="server"
            Text="Clear"
            onclick="btnClear_Click" />
    </div>       
    </telerik:RadAjaxPanel>
</asp:Content>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
 
public partial class CMS_HomeQuickLinks : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadGrid();
    }
 
    public void LoadGrid()
    {
        gridQL.DataSource = new List<string>(0);
        gridQL.DataBind();
        gridQL.DataSource = NextGen.core.CMS.HomeQuickLinkManager.GetList();
        gridQL.DataBind();
    }
 
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        NextGen.core.CMS.HomeQuickLink QL = new NextGen.core.CMS.HomeQuickLink();
        NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
        QL.LinkTitle = txtLinkTitle.Text;
        QL.LinkURL = txtLinkURL.Text;
        QL.ShowDate = (DateTime)dateShowDate.SelectedDate;
        QL.CreatedID = Int32.Parse(Session["ProfileID"].ToString());
        m.Add(QL);
        LoadGrid();
        ClearFields();
    }
 
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        NextGen.core.CMS.HomeQuickLink QL = new NextGen.core.CMS.HomeQuickLink();
        NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
        QL.HomeQuickLinkID = Int32.Parse(hideID.Value);
        QL.LinkTitle = txtLinkTitle.Text;
        QL.LinkURL = txtLinkURL.Text;
        QL.ShowDate = (DateTime)dateShowDate.SelectedDate;
        QL.UpdatedID = Int32.Parse(Session["ProfileID"].ToString());
        m.Edit(QL);
        LoadGrid();
        ClearFields();
    }
 
    public void ClearFields()
    {
        hideID.Value = "";
        txtLinkTitle.Text = "";
        txtLinkURL.Text = "";
        dateShowDate.Clear();
        lblCreated.Text = "";
        lblUpdated.Text = "";
        LoadGrid();
        btnAdd.Visible = true;
        btnUpdate.Visible = false;
    }
 
    protected void RadGrid_ItemCommand(object source, GridCommandEventArgs e)
    {
        ClearFields();
        int QLID = (int)e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["HomeQuickLinkID"];
        if (e.CommandName == "RowClick" || e.CommandName == "EditQL")
            GetQL4Edit(QLID);
 
        if (e.CommandName == "DeleteQL")
        {
            NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
            m.Remove(QLID);
            ClearFields();
        }
 
        if (e.CommandName == "UpQL")
        {
            NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
            m.OrderUp(QLID);
            LoadGrid();
        }
 
        if (e.CommandName == "DownQL")
        {
            NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
            m.OrderDown(QLID);
            LoadGrid();
        }
    }
 
    protected void RadGrid_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        //if (e.Item is GridDataItem)
        //{
        //    foreach (GridDataItem item in gridAnnouncements.MasterTableView.Items)
        //    {
        //        if (item.ItemIndex == 0)
        //        {
        //            LinkButton btn = (LinkButton)item["UpAnnouncement"].Controls[0];
        //            btn.Visible = false;
        //            item.Display = false;
        //            break; //terminates the for loop
        //        }
        //    } 
        //}
    }
 
    public void GetQL4Edit(int intID)
    {
        NextGen.core.CMS.HomeQuickLink QL = NextGen.core.CMS.HomeQuickLinkManager.GetRecord(intID);
        hideID.Value = intID.ToString();
        txtLinkTitle.Text = QL.LinkTitle;
        txtLinkURL.Text = QL.LinkURL;
        dateShowDate.SelectedDate = QL.ShowDate;
        lblCreated.Text = QL.CreatedName + " on " + QL.CreatedDate.ToShortDateString() + " " + QL.CreatedDate.ToShortTimeString();
        lblUpdated.Text = QL.UpdatedName + " on " + QL.UpdatedDate.ToShortDateString() + " " + QL.UpdatedDate.ToShortTimeString();
        btnAdd.Visible = false;
        btnUpdate.Visible = true;
    }
 
    protected void btnClear_Click(object sender, EventArgs e)
    {
        ClearFields();
    }
 
    protected void grdPendingOrders_RowDrop(object sender, GridDragDropEventArgs e)
    {
        //int o = 0;
        //NextGen.core.CMS.HomeQuickLinkManager m = new NextGen.core.CMS.HomeQuickLinkManager();
        //foreach (GridDataItem i in e.[ReorderedItemsLists])
        //{
        //    o = o + 1;
        //    m.EditOrder((int)draggedItem.GetDataKeyValue("HomeQuickLinkID"), o);           
        //}
        //LoadGrid();
    }
}

6 Answers, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 11 Nov 2010, 02:28 PM
Hi James,

You should take into consideration the difference between Advanced databinding and Simple databinding for the RadGrid control and rework your code along the lines of the former. Whenever you need to populate the grid with new data, assign its DataSource property and call its Rebind() (not DataBind() ) method.

Hope this information helps.

Regards,
Tsvetoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
James O'Brien
Top achievements
Rank 1
answered on 11 Nov 2010, 03:03 PM
You believe my binding is what's creating this error? I so this all through my application and never had a problem. The error is pointing to The Ajax Script Manager?
0
Maria Ilieva
Telerik team
answered on 11 Nov 2010, 04:10 PM
Hi James O'Brien,

Please review the answer provided in the firstly opened support ticket. I hope it will help.
If further questions arise please consider continuing the correspondence in the support ticket for easier tracking.



Regards,
Maria Ilieva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Craig Wallace
Top achievements
Rank 1
answered on 21 Dec 2010, 04:21 PM
I am getting the same error after upgrading to 2010.3.1215.40.  Can you share the solution?

Craig
0
Maria Ilieva
Telerik team
answered on 22 Dec 2010, 10:10 PM
Hi Craig,

Thank you for contacting us.

The mentioned error mostly appears if the same part of the page is updated with the both RadAjaxManager and RadAjaxPanel at the same time. Please note that using both ajax controls (RadAjaxManager and RadAjaxPanel for updating the same content on the page is not supported scenario. Adding RadAjaxPanel into the RadAjaxManager settings may lead to a lot of different issue.
I hope this helps.



Best wishes,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Craig Wallace
Top achievements
Rank 1
answered on 04 Jan 2011, 10:03 AM
Hi Maria,

It seems I had upgraded to the trial version of the assemblies, which caused the problem.

Craig
Tags
Ajax
Asked by
James O'Brien
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
James O'Brien
Top achievements
Rank 1
Maria Ilieva
Telerik team
Craig Wallace
Top achievements
Rank 1
Share this question
or