Okay, here's what I did so far:
if (e.Day.Date.Day.ToString() == Convert.ToString(Eval("mtgDateStart")))
{
e.Cell.BackColor = Color.Navy;
}
I do not get any error during compilation but I received this error when viewing through IE...
Well, I don't have any variable define anywhere else other than what is showing in my code behind showing above. Here's all I have in my .aspx page.
<form id="cldrBoardMeeting" runat="server">
<asp:DataList ID="DataList1" runat="server" DataSourceID="slqBoardMtng">...
This is what I have in the SQL server.
CREATE TABLE eventMtg_date (
mtgID int NOT NULL,
mtgTitle varchar(250) NOT NULL default '',
mtgDscrt text,
mtgPlace varchar(100) default NULL,
mtgLocation varchar(100) default NULL,
mtgDateStart datetime NOT NULL default '0000-00-00 00:00:00'...
First error:
Error 1 Cannot convert method group 'ToShortDateString' to non-delegate type 'System.DateTime'. Did you intend to invoke the method? U:\eventCal.aspx.cs 25 25 U:\
On this line:
dateStart = dateStart.ToShortDateString;
Second error:
Error 2 Operator '==' cannot be applied to...
Okay, this time I got on this line:
if (e.Day.Date.Day.ToString() == dateStart)
The error is:
Error 2 Operator '==' cannot be applied to operands of type 'string' and 'System.DateTime' U:\eventCal.aspx.cs 31 17 U:\
I got this error:
Error 1 Cannot convert method group 'ToShortDateString' to non-delegate type 'string'. Did you intend to invoke the method? U:\eventCal.aspx.cs 23 32 U:\
This is the error message on that line:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
That seems to do the trick; however, I got error on this line:
string dateStart = Convert.ToString(Eval("mtgDateStart"));
I want to convert it to Short so I tried this:
string dateStart = Convert.ToDateTime(Eval("mtgDateStart")).ToShortDateString;
But it is not taking that either. How do I...
And the error occurs when building the page:
Error 1 'eventCal.calDayRender(object, System.Web.UI.WebControls.DayRenderEventArgs)' is inaccessible due to its protection level U:\eventCal.aspx 30
This line is referring to this:
OnDayRender="calDayRender
Is there a way to bind a Calendar to a SqlDataSource? I like to create a calendar where if there is an event scheduled it will show up as highlighted on the calendar. Help is much appreciated.
Thanks! I got it working using another application. I was referring to when adding and creating new tables. I'm not talking from the user's point of view.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.