c# - DayPilot - returning a new View on EventClick -
i attempting implement daypilot lite mvc on project. i've set events , clickable(tested debug statement). looking process click , load new view, using viewmodel built id of event clicked.
public actionresult booking() { applicationdbcontext db = new applicationdbcontext(); int id = dpc.eventid; if (id == null) { return new httpstatuscoderesult(httpstatuscode.badrequest); } lesson lesson = db.lessons.find(id); if (lesson == null) { return httpnotfound(); } return view(lesson); } class dpc : daypilotcalendar { public int eventid; protected override void oninit(initargs e) { applicationdbcontext db = new applicationdbcontext(); events = ev in db.lessons select ev; dataidfield = "classid"; datatextfield = "classlevel"; datastartfield = "classstartdate"; dataendfield = "classenddate"; update(); } protected override void oneventclick(eventclickargs e) { //test check method firing debug.writeline("hey clicked you"); //parse event id processing eventid = int.parse(e.id); //redirect booking page redirect("schedule/booking"); } }
when tried code booking method, resulted in telling me dpc.eventid needs object reference. have tried making class , variable public, error persists. can't make eventclick public can't override original. i'm using redirect because if try other link fails same reason. i'm guessing it's because it's non-inherited subclass, should not still able access member attributes if have public scope?
Comments
Post a Comment