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

Microsoft Jscript error. this.cell.ofsetHeitght is null or not an object

4 Answers 46 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Frank asked on 23 Apr 2012, 10:24 AM
Hi
 This is another error that I am getting:
Microsoft Jscript error. rows.0.cells is null or not and objehct

I get the above mentioned error when I transfere the database connection from the ASP.NET connetions in the code behind. I used the example http://demos.telerik.com/aspnet-ajax/scheduler/examples/resourceavailability/defaultcs.aspx.

The demo works fine as it is but  when I do the changes to bind the RadScheduler from code behind, I get errors.

This is my code behind, please assist:

 protected void Page_Load(object sender, EventArgs e)
        {
           // XmlDocument xDoc = new XmlDocument();
          //  xDoc = DataTableToXmlDocument(getAppointment);
            //r order = xDoc.ChildNodes[2];
          // XmlDataSource1.Data = DataTableToXmlDocument(getAppointment).InnerXml;
           // xDoc = DataTableToXmlDocument(getAppointment).InnerXml;
            getmyAppointments();
            getmyRooms();
           
         // XmlDataSource1.DataBind();
        }
     
        public void getmyRooms()
        {
            SqlConnection myConnection = new SqlConnection();
            myConnection.ConnectionString = WebConfigurationManager.ConnectionStrings["Localstring"].ConnectionString;  
            SqlCommand myCommand = new SqlCommand();
            myCommand.CommandText = "SELECT [RoomID], [Name] FROM [Grouping_Rooms]";  
            myCommand.Connection = myConnection;  
            SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);  
            DataSet productsDataSet = new DataSet();  
            myAdapter.Fill(productsDataSet);
           
            ResourceType RT = new ResourceType();
            RT.DataSource = productsDataSet.Tables[0];
            RT.KeyField = productsDataSet.Tables[0].Columns[0].ToString();
            RT.ForeignKeyField = productsDataSet.Tables[0].Columns[0].ToString();
            RT.TextField= productsDataSet.Tables[0].Columns[1].ToString();
            RadScheduler1.ResourceTypes.Add(RT);
           
            
        }

        public void getmyAppointments()
        {
            SqlConnection myConnection = new SqlConnection();
            myConnection.ConnectionString = WebConfigurationManager.ConnectionStrings["Localstring"].ConnectionString;  
            SqlCommand Command = new SqlCommand();
            Command.CommandText = "SELECT [ID], [Description], [Start], [End], [RoomID], [RecurrenceRule], [RecurrenceParentID] FROM [Grouping_Events]";  
            Command.Connection = myConnection;  
            SqlDataAdapter Adapter = new SqlDataAdapter(Command);  
            DataSet AppDataSet = new DataSet();
            Adapter.Fill(AppDataSet);
           // RadScheduler1.
            RadScheduler1.DataKeyField = AppDataSet.Tables[0].Columns[0].ToString();
            RadScheduler1.DataSubjectField = AppDataSet.Tables[0].Columns[1].ToString();
            RadScheduler1.DataStartField = AppDataSet.Tables[0].Columns[2].ToString();
            RadScheduler1.DataEndField = AppDataSet.Tables[0].Columns[3].ToString();
            RadScheduler1.DataSource = AppDataSet.Tables[0];
          
            RadScheduler1.DataBind();
          
        }

4 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 23 Apr 2012, 11:59 AM
Hello Frank,

Please, specify Name for your resource type. Also, make sure the GroupBy property is set to the name of the resource type. For example, if you have:

ResourceType RT = new ResourceType(); 
RT.Name = "Room";

then set GroupBy="Room" for RadScheduler.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Frank
Top achievements
Rank 1
answered on 23 Apr 2012, 12:17 PM
Hi Peter
 
Thanks a  million!

I just removed the code below from aspx file and define it in the aspx as adviced and it works now!
 <ResourceTypes>
                    <telerik:ResourceType  KeyField="RoomID" Name="Room" ForeignKeyField="RoomID" TextField="Name"/>
                </ResourceTypes>

Regards
Frank
0
Frank
Top achievements
Rank 1
answered on 23 Apr 2012, 12:30 PM
Hi Peter

I have replace the dataset that is filled with database values with a dataset that I am retrieving from the table that I created as show below and I still get the same error. Do you know what might be the reason?

SqlConnection myConnection = new SqlConnection();
            myConnection.ConnectionString = WebConfigurationManager.ConnectionStrings["Localstring"].ConnectionString;  
            SqlCommand myCommand = new SqlCommand();
            myCommand.CommandText = "SELECT [RoomID], [Name] FROM [Grouping_Rooms]";  
            myCommand.Connection = myConnection;  
            SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand);  
            DataSet productsDataSet = new DataSet();  
            myAdapter.Fill(productsDataSet);
           
            ResourceType RT = new ResourceType();
            RT.Name = "Room";
            RT.DataSource = getRooms.Tables[0];
            RT.KeyField = getRooms.Tables[0].Columns[0].ToString();
            RT.ForeignKeyField = getRooms.Tables[0].Columns[0].ToString();
            RT.TextField = getRooms.Tables[0].Columns[1].ToString();
            RadScheduler1.ResourceTypes.Add(RT);
            getmyAppointments(RadScheduler1);

  protected DataSet getRooms
        {
             
            get
            {
                DataSet rooms = new DataSet();
                DataTable dtblroom;
                dtblroom = new DataTable();
                dtblroom.Columns.Add("RoomID", typeof(Int32));
                dtblroom.Columns.Add("Name", typeof(string));
              
                DataRow dr;
                dr = dtblroom.NewRow();
                dr["RoomID"] = 1;
                dr["Name"] = "Development";

                dr = dtblroom.NewRow();
                dr["RoomID"] = 2;
                dr["Name"] = "Finance";
                rooms.Tables.Add(dtblroom);
                return rooms;
            }
        }
        private void Up
0
Peter
Telerik team
answered on 25 Apr 2012, 11:00 AM
Hi Frank,

If you can isolate the problem in a sample project and send it to via a support ticket and can look into it and try to help you.

All the best,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
Frank
Top achievements
Rank 1
Answers by
Peter
Telerik team
Frank
Top achievements
Rank 1
Share this question
or