Throwing javascript error "RadGrid for SharePoint 2010"

12 posts, 0 answers
  1. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 19 Jul 2010 Link to this post

    Hi All,

    I am getting javascript error "object doesnt support this property or method" when I am trying to show RadGrid in SharePoint 2010 site.
     
    Given below are the steps followed.
    1. Created a web part which binds sample data to the RadGrid in CreateChildControls() overriden method.
    2. Deployed the web part in SharePoint server.
    3. Added the web part to the web part gallery.
     
    Now when trying to add the web part in the page, it throws javascript error. Debugging the error found that this is thrown from Sys.Application.add_init()
    {
    $create(Telerik.Web.UI.RadGrid,........)
    }
     
    Can you please help me out in resolving this?

    Note: Telerik.Web.UI version is 2008 and SharePoint 2010 Beta version.

    Thanks in advance.
  2. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 20 Jul 2010 Link to this post

    vinitha, is there some javascript hooked to grid that may not be run properly - client events or other? This error may be because of that.

    Also I know that Sharepoint 2010 is already official and RadControls for AJAX current version is 2010.2.713. If you follow release notes, u know Telerik have Sp 2010 web parts for grid and editor.

    Prangadj

  3. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 20 Jul 2010 Link to this post

    Hi,

    Thanks for the response.

    No client side events. Here is the code that i have put in the webpart.

    RadGrid radGrid1;

    protected override void CreateChildControls()
            {
                base.CreateChildControls();

                radGrid1 = new RadGrid();
                radGrid1.DataSource = GetData();
                radGrid1.DataBind();
                this.Controls.Add(radGrid1);
               
            }

            private DataTable GetData()
            {
              DataTable dt = new DataTable("Employee");
              dt.Columns.Add("Id");
              dt.Columns.Add("FirstName");
              dt.Columns.Add("LastName");

              for (int i = 1; i <= 10; i++)
              {
                DataRow dr = dt.NewRow();
                dr["Id"] = i.ToString();
                dr["FirstName"] = "XXXX" + i.ToString();
                dr["LastName"] = "YYYYY" + i.ToString();
                dt.Rows.Add(dr);
              }

              return dt;
            }

    }

    Deployed the web part. When i try to add the web part to the page, it throws javascript error "Object doesnt support this method or property"

    Please do help me in resolving this.

    Thanks in advance.
  4. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 20 Jul 2010 Link to this post

    Do you get same error when you put Microsoft GridView instead of RadGrid? Also test with official Sharepoint 2010.

    Prangadj
  5. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 20 Jul 2010 Link to this post

    Hi,

    I dont get any error when i use <asp:GridView> control. I dont have the official version with me right now. So cant try on it. Can someone verify whether this issue exists in SharePoint 2010 Beta version?

    Thanks in advance.

  6. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 20 Jul 2010 Link to this post

    Hi,

    Verified the same in official SharePoint 2010 version. I see the same error "Object doesnt support this method or property".

    Can someone verify this and let me know as how to resolve this?

    Thanks in advance.
  7. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 20 Jul 2010 Link to this post

    What happens if you set id for the dynamic grid as so:

    protected override void CreateChildControls()
            {
                base.CreateChildControls();
      
                radGrid1 = new RadGrid();
                radGrid1.ID = "radGrid1";
                radGrid1.DataSource = GetData();
                radGrid1.DataBind();
                this.Controls.Add(radGrid1);
                  
            }
      
            private DataTable GetData()
            {
              DataTable dt = new DataTable("Employee");
              dt.Columns.Add("Id");
              dt.Columns.Add("FirstName");
              dt.Columns.Add("LastName");
      
              for (int i = 1; i <= 10; i++)
              {
                DataRow dr = dt.NewRow();
                dr["Id"] = i.ToString();
                dr["FirstName"] = "XXXX" + i.ToString();
                dr["LastName"] = "YYYYY" + i.ToString();
                dt.Rows.Add(dr);
              }
      
              return dt;
            }
      
    }

    If it's the same, post the code from the page where you add the web part for more research.

    Prangadj
  8. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 21 Jul 2010 Link to this post

    I tried setting "Id" for the dynamically added RadGrid as per your suggestion. But no luck. I still get the error.

    I have created a blank site and added this web part to it. Which code you want me to send?
  9. Prangadj
    Prangadj avatar
    174 posts
    Member since:
    Jan 2008

    Posted 21 Jul 2010 Link to this post

    Show me html/codebehind source of the page where you add the webpart. Also show me what you see from the FireBug console when this page loads (attach screen capture).

    Prangadj
  10. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 21 Jul 2010 Link to this post

    I am unable to send the view source as we can only attach .jpg, .jpeg and so on. Unable to send the screen shot as its exceeding the limit. Any other source of sending the details?
  11. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 21 Jul 2010 Link to this post

    I am unable to send the view source as we can only attach .jpg, .jpeg and so on. Unable to send the screen shot as its exceeding the limit. Any other source of sending the details?
  12. vinitha
    vinitha avatar
    77 posts
    Member since:
    Aug 2007

    Posted 22 Jul 2010 Link to this post

    Hi All,

    Issue got resolved by using Telerik 2010 version dlls. But i am facing a different issue now.

    OnSelectedIndexChanged event is getting fired only once after the page is loaded. Can someone help me out in this?

    Thanks in advance.
Back to Top