Click here to Skip to main content
15,884,176 members
Articles / Web Development / HTML

DayPilot Gantt Chart for ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.85/5 (21 votes)
21 Mar 2016Apache3 min read 99.2K   4.2K   62  
How to display AJAX Gantt Chart in ASP.NET application.
using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.UI;
using Util;

public partial class Project_Edit : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.Cache.SetNoStore();

        if (!IsPostBack)
        {
            DataRow dr = new DataManager().GetAssignment(Convert.ToInt32(Request.QueryString["id"]));

            TextBoxStart.Text = Convert.ToDateTime(dr["AssignmentStart"]).ToShortDateString();
            DropDownListDuration.SelectedValue = Convert.ToString(dr["AssignmentDuration"]);
            TextBoxNote.Text = Convert.ToString(dr["AssignmentNote"]);

        }
    }


    protected void ButtonOK_Click(object sender, EventArgs e)
    {
        string note = TextBoxNote.Text;
        int id = Convert.ToInt32(Request.QueryString["id"]);
        int duration = Convert.ToInt32(DropDownListDuration.SelectedValue);
        DateTime start = Convert.ToDateTime(TextBoxStart.Text);

        new DataManager().UpdateAssignment(id, note, duration, start);
        
        Hashtable ht = new Hashtable();
        ht["refresh"] = "yes";
        ht["message"] = "Event updated.";

        Modal.Close(this, ht);
    }

    protected void ButtonCancel_Click(object sender, EventArgs e)
    {
        Modal.Close(this);
    }

    protected void ButtonDelete_Click(object sender, EventArgs e)
    {
        new DataManager().DeleteAssignment(Convert.ToInt32(Request.QueryString["id"]));
        Hashtable ht = new Hashtable();
        ht["refresh"] = "yes";
        ht["message"] = "Event deleted.";
        Modal.Close(this, ht);
        //ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "<script type='text/javascript'>setTimeout(function() { modal.close({refresh:'yes',message:'Event deleted'); }, 0);</script>", false);
    }

    protected void UpdatePanel_Load(object sender, EventArgs e)
    {
        //ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "<script type='text/javascript'>setTimeout(function() { modal.stretch(); }, 0);</script>", false);
    }


}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Czech Republic Czech Republic
My open-source event calendar/scheduling web UI components:

DayPilot for JavaScript, Angular, React and Vue

Comments and Discussions