CodeBehind error

  • Thread starter Thread starter tshad
  • Start date Start date
T

tshad

I have a code behind line that is giving me the error:

**********************************************************************
Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30456: 'SelectedDate' is not a member of
'System.Web.UI.WebControls.DataGrid'.

Source Error:

Line 36:
Line 37: Sub DayChanged(s as Object, e As EventArgs)
Line 38: Response.Redirect("DisplayEvents.aspx?myDate=" &
myCalendar.SelectedDate)
Line 39: end Sub
**********************************************************************

The code (as you can see from above) is:
***************************************************************
Sub DayChanged(s as Object, e As EventArgs)
Response.Redirect("DisplayEvents.aspx?myDate=" & myCalendar.SelectedDate)
end Sub
****************************************************************

"myDate" is not in my program. It is just the name that DisplayEvents.aspx
expects.

Why am I getting the error and what do I add to my code behind to resolve
it?

Thanks,

Tom.
 
The compiler thinks that myCalendar is a DataGrid (which doesn't have
a SelectedDate method) and the code inthe event handler seems to be
assuming its a Calendar.

Is it just the case that myCalendar should be declared as a Calendar
and not a DataGrid?
 
Rob said:
The compiler thinks that myCalendar is a DataGrid (which doesn't have
a SelectedDate method) and the code inthe event handler seems to be
assuming its a Calendar.

Is it just the case that myCalendar should be declared as a Calendar
and not a DataGrid?

That was it.

I had taken my page and split it into 2 to create a code behind and had
inadvertantly said:

Protected WithEvents myCalendar As DataGrid

instead of

Protected WithEvents myCalendar As Calendar

Thanks,

Tom.
 
Back
Top