c# - Setting a DateTime appointment schedule -
newbie question using datetime method set schedule inside telerik calendar. want use telerik controls calendar set schedule music bands tour schedule.
i can't seem desired results. below code in sampleappointmentsource cs file. thought setting datetime.parse("5/19/2013") in of appointments when use adddays(1) or adddays(20) appointemnts follow datetime.parse("5/19/2013") pattern doesn't. appointments use current date , time (now). when add days, appointments aren't added parsed date ("5/19/2013"), added current datetime. appointments referenced current system date.
i hope wasn't confusing....
what need use desired results?
is because of datetime.now.adddays(1) line? should not datetime.now?
{ public class sampleappointmentsource : appointmentsource { public sampleappointmentsource() { datetime date = new datetime(); date = datetime.parse("5/19/2013"); } public override void fetchdata(datetime startdate, datetime enddate) { this.allappointments.clear(); this.allappointments.add(new sampleappointment() { startdate = datetime.now.adddays(1), enddate = datetime.now.adddays(1), subject = "jackson w/warren hayes", additionalinfo = "fain feild", location = "loserville,kentucky", });
fleshing out comment question. create datetime
object called date
, never use it. datetime.now return object containing current datetime
. need give date
datetime object module level scope can access in fetchdata
method. see if works your.
public class sampleappointmentsource : appointmentsource { datetime date; public sampleappointmentsource() { date = datetime.parse("5/19/2013"); } public override void fetchdata(datetime startdate, datetime enddate) { this.allappointments.clear(); this.allappointments.add(new sampleappointment() { startdate = date.adddays(1), enddate = date.adddays(1), subject = "jackson w/warren hayes", additionalinfo = "fain feild", location = "loserville,kentucky", }); } }
Comments
Post a Comment