control views from external button.

I use mvc4/razor.
how to control day,week and month view from external buttons.
these are my buttons in _Layout.cshtml view.

  • Day
    Day
  • Week
    Week
  • Month
    Month
  • Hi,
    you can switch views with client-side scheduler.setCurrentView method
    docs.dhtmlx.com/doku.php?id=dhtm … urrentview
    e.g.:
    scheduler.setCurrentView(date, viewName);//change view and date
    scheduler.setCurrentView(null, “day”);//switch view without changing the date

    No, I need the the “Day” button created by me with html to do the function of “Today” button in dhtmlx scheduler.

    if you call this code from onclick of your button, it will do exactly what you need scheduler.setCurrentView(new Date(), "day");

    i replace the code this way:
    $("#Day").bind(“click”, function () {
    scheduler.setCurrentView(new Date(), “day”);
    });

            $("#Week").bind("click", function () {
                scheduler.setCurrentView(new Week(), "week");
            });
    
            $("#Day").bind("click", function () {
                scheduler.setCurrentView(new Month(), "month");
            });
    

    only dayview is changing as per the button click. Please help.

    it helped only for day view in scheduler.
    If i click week button which i created should do the function of “week” button in the scheduler.
    Same for month button too.

    just like the image

    just like this image

    First parameter of .setCurrentView is a date to be displayed in the view
    in following code:
    scheduler.setCurrentView(new Date(), “day”);
    new Date() creates new instance js Date object with current date and time, so day view will be opened on current date.
    w3schools.com/js/js_obj_date.asp
    Following should work:[code]$("#Week").bind(“click”, function () {
    scheduler.setCurrentView(new Date(), “week”);
    });

    $("#Day").bind(“click”, function () {
    scheduler.setCurrentView(new Date(), “month”);[/code]

    Its working. So “week” and “month” are the instance name for dayview and weekview? ThanksaLot.
    Now I’m using unitsview,weekview and monthview only.

    How do I hide day view totally?Only hiding “Day” button via CSS is enough?

    Exactly, on the server side these names can be accessed as ViewObject.Name. For example new DayView().Name// returns "day"
    most of the views have fixed names(“day”, “week”, “month”, “year”…),
    However, Timeline, Units and Grid views can have different names, that allows to have several views of one type in the calendar. Names are specified explicitly in the object constructor.
    For example

    var unit = new UnitsView("my_unit_view", "section_id"); Created view will have name “my_unit_view”, to activate this view on the client you’ll should call
    scheduler.setCurrentView(new Date(), “my_unit_view”);

    yes, it will work