search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Microsoft JScript runtime error: Unable to get value of the property 'rows': object is null or undefined

Asked by sree
7 years ago.

Hi,

Daypilotcalendar is producing the above javascript error after it is rendered. It is mainly occuring when i am trying to use the scroll bar in the page. How can i solve this..

thanks in advance

Comment posted by Dan Letecky [DayPilot]
7 years ago.

1. What version of DayPilot are you using?
2. Have you defined any resources (Resources collection)?

Comment posted by Anonymous
7 years ago.

I am using daypilotpro trial 7.3 version. No i haven't defined any resources as i am working on daypilotcalendar

Comment posted by Dan Letecky [DayPilot]
7 years ago.

I see. Would you be able to create a simple page/project that reproduces the error? If you send it to support@daypilot.org I will take a look at it.

Comment posted by Anonymous
7 years ago.

Hi Dan,

Here is the code behind of the page which is generating the error. Through this code only i am creating the daypilotcalendar dynamically. It is a lengthy code but can you please take a look at it. Because the error is getting generated every time

Private Function createdaypilotcalendar() As Boolean

Dim cnt As Integer
cnt = 0
Dim dtable As New DataTable()
Dim copytable As New DataTable()
Dim ttable As New DataTable()
dtatable = DirectCast(ViewState("datatable"), DataTable)
For Each dtarow As DataRow In dtatable.Rows

If cnt >= 1 Then
If Session("userid").ToString() = dtarow.Item(0).ToString() Then
addBlocks(DirectCast(ViewState("tdydate"), Date), dtarow.Item(7).ToString(), dtarow.Item(8).ToString(), dtarow.Item(9).ToString())
Else
Session("userid") = dtarow.Item(0).ToString()
Dim userid, rowno As Integer
rowno = dtatable.Rows.IndexOf(dtarow) - 1
userid = Convert.ToInt16(dtatable.Rows(rowno).Item(0).ToString())
Dim daypilotcalendar As New DayPilotCalendar()
AddHandler daypilotcalendar.BeforeEventRender, AddressOf DayPilotCalendar1_BeforeEventRender
'RaiseEvent daypilotcalendar.BeforeEventRender += DayPilotCalendar1_BeforeEventRender(daypilotcalendar,)

'daypilotcalendar.ID = "daypilotcalendar" + cnt.ToString()
daypilotcalendar.DataStartField = "start"
daypilotcalendar.DataEndField = "end"
daypilotcalendar.DataTextField = "name"
daypilotcalendar.DataValueField = "id"
daypilotcalendar.BusinessBeginsHour = "6"
daypilotcalendar.BusinessEndsHour = "18"
daypilotcalendar.DayBeginsHour = 6
daypilotcalendar.DayEndsHour = 18
daypilotcalendar.UseEventBoxes = Enums.UseBoxesEnum.Always
daypilotcalendar.ShowToolTip = True
daypilotcalendar.CellDuration = 15
daypilotcalendar.CellHeight = 15
daypilotcalendar.DurationBarVisible = False
daypilotcalendar.EventArrangement = Enums.ArrangementType.Cascade

'daypilotcalend()

'daypilotcalendar.DataBarColorField = "barColor"
'daypilotcalendar.ShowTimeField = "showtime"
'daypilotcalendar.EventColorField = "eventColor"
'Dim eventColor As String
'eventColor = "#FFC870"

Dim colconverter As New System.Drawing.ColorConverter()
ttable = DirectCast(ViewState("table"), DataTable)
'CType(colconverter.ConvertFromString(eventBackColor), Color)
'daypilotcalendar.EventBackColor = CType(colconverter.ConvertFromString(ttable.Rows.Item(6).ToString()), Color)

'AddHandler DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventHandler, daypilotcalendar_beforeEventRenderEventArgs()
'daypilotcalendar.ShowHeader = "True"
'daypilotcalendar.EventBackColor = System.Drawing.Color.FromName("eventColor")
'daypilotcalendar.BeforeEventRender += New EventHandler(daypillotcalendar_BeforeEventRender)
'DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs(daypilotcalendar, daypilotcalendar)

'daypil(DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs)
daypilotcalendar.StartDate = DirectCast(ViewState("tdydate"), Date)
daypilotcalendar.Width = 250
daypilotcalendar.Height = 500
daypilotcalendar.ColumnMarginRight = 2
daypilotcalendar.EventCorners = Enums.CornerShape.Rounded
'daypilotcalendar.HourHeight = 60
'daypilotcalendar.ShowToolTip = True
'daypilotcalendar.ShowHours = True

'daypilotcalendar.CellDuration = "cellduration"

If ViewState("firstuserid").ToString() <> userid.ToString() Then
daypilotcalendar.ShowHours = False
End If

'ttable = DirectCast(ViewState("table"), DataTable)
If ttable.Rows.Count > 0 Then
daypilotcalendar.DataSource = ttable
daypilotcalendar.DataBind()
Dim tblcell As New HtmlTableCell
tblcell.Controls.Add(daypilotcalendar)
tblcell.Align = "center"
row.Cells.Add(tblcell)
End If
'Session.Remove("table")
'Dim daypilotcalendar As New DayPilotCalendar()
copytable = DrawEvent(DirectCast(ViewState("tdydate"), Date), dtarow.Item(1).ToString(), dtarow.Item(2).ToString(), dtarow.Item(3).ToString(), dtarow.Item(4).ToString(),
dtarow.Item(5).ToString(), dtarow.Item(6).ToString(), dtarow.Item(7).ToString(), dtarow.Item(8).ToString(), dtarow.Item(9).ToString())

If dtatable.Rows.IndexOf(dtarow) = datacount - 1 Then
Dim daypilotcalendar1 As New DayPilotCalendar()
AddHandler daypilotcalendar1.BeforeEventRender, AddressOf DayPilotCalendar1_BeforeEventRender

'daypilotcalendar.ID = "daypilotcalendar" + cnt.ToString()
daypilotcalendar1.DataStartField = "start"
daypilotcalendar1.DataEndField = "end"
daypilotcalendar1.DataTextField = "name"
daypilotcalendar1.DataValueField = "id"
daypilotcalendar1.BusinessBeginsHour = "6"
daypilotcalendar1.BusinessEndsHour = "18"
daypilotcalendar1.DayBeginsHour = 6
daypilotcalendar1.DayEndsHour = 18
'daypilotcalendar1.DataBarColorField = "barColor"
'daypilotcalendar1.ShowTimeField = "showtime"
daypilotcalendar1.ShowToolTip = True
daypilotcalendar1.EventArrangement = Enums.ArrangementType.Cascade

Dim colconverter1 As New System.Drawing.ColorConverter()

'daypilotcalendar1.EventBackColor = CType(colconverter1.ConvertFromString(copytable.Rows.Item(6).ToString()), Color)
'CType(colconverter1.ConvertFromString(eventBackColor1), Color)

daypilotcalendar1.DurationBarVisible = False
'daypilotcalendar1.EventBackColor = System.Drawing.Color.FromName("eventColor")
daypilotcalendar1.ShowHeader = "True"
daypilotcalendar1.StartDate = DirectCast(ViewState("tdydate"), Date)
daypilotcalendar1.Width = 250
daypilotcalendar1.Height = 500
daypilotcalendar1.ShowHours = False
daypilotcalendar1.ColumnMarginRight = 2
daypilotcalendar1.CellDuration = 15
daypilotcalendar1.CellHeight = 15
daypilotcalendar1.UseEventBoxes = Enums.UseBoxesEnum.Always
daypilotcalendar1.EventCorners = Enums.CornerShape.Rounded
'daypilotcalendar1.HourHeight = 60
'daypilotcalendar1.ShowToolTip = True
'daypilotcalendar1.ShowHours = True
'daypilotcalendar1.CellDuration = "cellduration"

daypilotcalendar1.DataSource = copytable
daypilotcalendar1.DataBind()
'Calendartable.Controls.Add(daypilotcalendar1)
Dim tablecell As New HtmlTableCell
tablecell.Controls.Add(daypilotcalendar1)
tablecell.Align = "center"
row.Cells.Add(tablecell)
End If
End If

Else
Session("userid") = dtarow.Item(0).ToString()
copytable = DrawEvent(DirectCast(ViewState("tdydate"), Date), dtarow.Item(1).ToString(), dtarow.Item(2).ToString(), dtarow.Item(3).ToString(), dtarow.Item(4).ToString(),
dtarow.Item(5).ToString(), dtarow.Item(6).ToString(), dtarow.Item(7).ToString(), dtarow.Item(8).ToString(), dtarow.Item(9).ToString())
'DayPilotCalendar.DataSource = copytable
'DayPilotCalendar.DataBind()
'cell.Controls.Add(daypilotcalendar)
'row.Cells.Add(cell)
If datacount = 1 Or dtatable.Rows.IndexOf(dtarow) = datacount - 1 Then
Dim daypilotcalendar As New DayPilotCalendar()
AddHandler daypilotcalendar.BeforeEventRender, AddressOf DayPilotCalendar1_BeforeEventRender

'daypilotcalendar.ID = "daypilotcalendar" + cnt.ToString()
daypilotcalendar.DataStartField = "start"
daypilotcalendar.DataEndField = "end"
daypilotcalendar.DataTextField = "name"
daypilotcalendar.DataValueField = "id"
daypilotcalendar.BusinessBeginsHour = "6"
daypilotcalendar.BusinessEndsHour = "18"
daypilotcalendar.DayBeginsHour = 6
daypilotcalendar.DayEndsHour = 18
daypilotcalendar.DurationBarVisible = False
daypilotcalendar.EventArrangement = Enums.ArrangementType.Cascade

'daypilotcalendar.even()
'daypilotcalendar.BeforeEventRender = beforeeventrender()
'daypilotcalendar.beforeeventrender =beforeeventrender(Obje
daypilotcalendar.UseEventBoxes = Enums.UseBoxesEnum.Always
'daypilotcalendar.DataBarColorField = "barColor"
daypilotcalendar.EventCorners = Enums.CornerShape.Rounded
'daypilotcalendar.EventBackColor = "eventBackColor"
'daypilotcalendar.ShowTimeField = "showtime"
'daypilotcalendar.EventColorField = "eventColor"
daypilotcalendar.ShowToolTip = True
daypilotcalendar.CellDuration = 15
daypilotcalendar.CellHeight = 15

Dim colconverter As New System.Drawing.ColorConverter()

daypilotcalendar.EventBackColor = CType(colconverter.ConvertFromString(copytable.Rows.Item(6).ToString()), Color)
'CType(colconverter.ConvertFromString(eventBackColor), Color)

'daypilotcalendar.BeforeEventRender += DayPilot.Web.Ui.Events.Calendar.BeforeEventRenderEventArgs
'daypilotcalendar.EventBackColor = System.Drawing.Color.FromName("eventColor")
'Dim colconverter As New System.Drawing.ColorConverter()
'daypilotcalendar.EventBackColor = (String)"eventBackColor"
'DirectCast(colconverter.ConvertFromString("eventColor"), Color)
daypilotcalendar.DataEndField =
daypilotcalendar.ShowHeader = "True"
daypilotcalendar.StartDate = DirectCast(ViewState("tdydate"), Date)
daypilotcalendar.Width = 250
daypilotcalendar.Height = 500

daypilotcalendar.ShowHours = False
daypilotcalendar.ColumnMarginRight = 2
'daypilotcalendar.HourHeight = 60
'daypilotcalendar.ShowToolTip = True
'daypilotcalendar.ShowHours = True
'daypilotcalendar.CellDuration = "cellduration"

daypilotcalendar.DataSource = copytable
daypilotcalendar.DataBind()
'Calendartable.Controls.Add(daypilotcalendar)
Dim tablecell As New HtmlTableCell
tablecell.Controls.Add(daypilotcalendar)
tablecell.Align = "center"
row.Cells.Add(tablecell)
End If
cnt = cnt + 1
End If
Next
Calendartable.Rows.Add(row)
Return True
End Function
Private Function addBlocks(ByVal tdydate As Date, ByVal bname As String, ByVal bstart As String, ByVal bstop As String) As Boolean
Dim datatable As New DataTable
datatable = DirectCast(ViewState("table"), DataTable)
Dim dr As DataRow
If bstart <> String.Empty Then
dr = datatable.NewRow()
Session("id") = 4
Session("id") = Session("id").ToString() + 1
dr("id") = Session("id")
dr("start") = DateTime.Parse(tdydate + " " + bstart)
dr("end") = DateTime.Parse(tdydate + " " + bstop)
dr("name") = bname
dr("barColor") = "#FFC870"
dr("eventBackColor") = "#FFC870"
'"#FFC870"
dr("showtime") = "true"

datatable.Rows.Add(dr)
End If
Return True
End Function

Private Function DrawEvent(ByVal tdydate As Date, ByVal wStart As String, ByVal wStop As String, ByVal hStart As String, ByVal hStop As String, ByVal lStart As String, ByVal lStop As String, ByVal bname As String, ByVal bStart As String, ByVal bstop As String) As DataTable

Dim dt As DataTable
dt = New DataTable()
dt.Columns.Add("start", GetType(DateTime))
dt.Columns.Add("end", GetType(DateTime))
dt.Columns.Add("name", GetType(String))
dt.Columns.Add("id", GetType(String))
dt.Columns.Add("barColor", GetType(String))
dt.Columns.Add("showtime", GetType(String))
'dt.Columns.Add("eventColor", GetType(System.Drawing.Color))
dt.Columns.Add("eventBackColor", GetType(String))
'dt.Columns.Add("eventBackColor", GetType(SystemColors))

'dt.Columns.Add()

Dim dr As DataRow

If wStart <> String.Empty Then
dr = dt.NewRow()
dr("id") = 0
Dim dateandtime, wstoptime As DateTime
dateandtime = Convert.ToDateTime(tdydate + " " + wStop)
wstoptime = dateandtime.AddMinutes(15)
dr("start") = DateTime.Parse(tdydate + " " + wStart)
dr("end") = DateTime.Parse(wstoptime)
dr("name") = "Work Hours"
dr("barColor") = "#ADCDFF"
dr("eventBackColor") = "#ADCDFF"
'#ADCDFF
dr("showtime") = "true"

dt.Rows.Add(dr)
End If
'If wStop <> String.Empty Then
' dr = dt.NewRow()
' dr("id") = 4
' Session("id") = 4
' Dim dateandtime, wstoptime As DateTime
' dateandtime = Convert.ToDateTime(tdydate + " " + wStop)
' wstoptime = dateandtime.AddMinutes(15)
' dr("start") = DateTime.Parse(tdydate + " " + wStop)
' dr("end") = DateTime.Parse(wstoptime)
' dr("name") = "Work Hours"
' dr("barColor") = "#ADCDFF"
' dr("eventColor") = "#ADCDFF"
' dr("showtime") = "true"

' dt.Rows.Add(dr)
'End If

If hStart <> String.Empty Then
dr = dt.NewRow()
dr("id") = 1
Dim dateandtime, hstoptime As DateTime
dateandtime = Convert.ToDateTime(tdydate + " " + hStop)
hstoptime = dateandtime.AddMinutes(15)
dr("start") = DateTime.Parse(tdydate + " " + hStart)
dr("end") = DateTime.Parse(hstoptime)
dr("name") = "Hearing Hours"
dr("barColor") = "#FFBBFF"
dr("eventBackColor") = "#FFBBFF"
'"#FFBBFF"
dr("showtime") = "true"

dt.Rows.Add(dr)
End If
'If hStop <> String.Empty Then
' dr = dt.NewRow()
' dr("id") = 2
' Dim dateandtime, hstoptime As DateTime
' dateandtime = Convert.ToDateTime(tdydate + " " + hStop)
' hstoptime = dateandtime.AddMinutes(15)
' dr("start") = DateTime.Parse(tdydate + " " + hStop)
' dr("end") = DateTime.Parse(hstoptime)
' dr("name") = "Hearing Hours"
' dr("barColor") = "#FFBBFF"
' dr("eventColor") = "#FFBBFF"
' dr("showtime") = "true"

' dt.Rows.Add(dr)
'End If
If lStart <> String.Empty Then
dr = dt.NewRow()
dr("id") = 3
dr("start") = DateTime.Parse(tdydate + " " + lStart)
dr("end") = DateTime.Parse(tdydate + " " + lStop)
dr("name") = "Lunch Hours"
dr("barColor") = "#FFC870"
dr("eventBackColor") = "#FFC870"
'"#FFC870"
dr("showtime") = "true"

dt.Rows.Add(dr)
End If
If bStart <> String.Empty Then
dr = dt.NewRow()
dr("id") = 5
dr("start") = DateTime.Parse(tdydate + " " + bStart)
dr("end") = DateTime.Parse(tdydate + " " + bstop)
dr("name") = bname
dr("barColor") = "#FFC870"
dr("eventBackColor") = "#FFC870"
'"#FFC870"
dr("showtime") = "true"

dt.Rows.Add(dr)

End If

ViewState("table") = dt

Return dt
End Function
Protected Sub DayPilotCalendar1_BeforeEventRender(sender As Object, e As BeforeEventRenderEventArgs)
e.BackgroundColor = e.DataItem("eventBackColor")
End Sub

Comment posted by Anonymous
7 years ago.

Hi Dan,

i want to explain you where exactly the javascript error is getting generated. Through above code i am generating daypilotcalendars based on number of users. The above error is coming in the webresource.axd which is getting generated for the daypilotcalendar for ScrollDownUrl,deleteimageurl, scrollupurl actions. When the exception is raised i have checked out the element which is raising, it is the second daypilotcalendar.I am not able to figure out why it is second one only. Can you please provide me solution as soon as you can because i got stuck with this, Since from 4 days.

Comment posted by sree
7 years ago.

Can anyone please respond to this question.

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.