Click here to Skip to main content
15,892,965 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.5K   4.2K   62  
How to display AJAX Gantt Chart in ASP.NET application.
Imports System
Imports System.Collections
Imports System.Data
Imports System.Web
Imports System.Web.UI
Imports Util

Partial Public Class Project_Edit
	Inherits Page

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
		Response.Cache.SetCacheability(HttpCacheability.NoCache)
		Response.Cache.SetNoStore()

		If Not IsPostBack Then
			Dim dr As DataRow = (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"))

		End If
	End Sub


	Protected Sub ButtonOK_Click(ByVal sender As Object, ByVal e As EventArgs)
		Dim note As String = TextBoxNote.Text
'INSTANT VB NOTE: The variable id was renamed since Visual Basic does not handle local variables named the same as class members well:
		Dim id_Renamed As Integer = Convert.ToInt32(Request.QueryString("id"))
		Dim duration As Integer = Convert.ToInt32(DropDownListDuration.SelectedValue)
		Dim start As Date = Convert.ToDateTime(TextBoxStart.Text)

		CType(New DataManager(), DataManager).UpdateAssignment(id_Renamed, note, duration, start)

		Dim ht As New Hashtable()
		ht("refresh") = "yes"
		ht("message") = "Event updated."

		Modal.Close(Me, ht)
	End Sub

	Protected Sub ButtonCancel_Click(ByVal sender As Object, ByVal e As EventArgs)
		Modal.Close(Me)
	End Sub

	Protected Sub ButtonDelete_Click(ByVal sender As Object, ByVal e As EventArgs)
		CType(New DataManager(), DataManager).DeleteAssignment(Convert.ToInt32(Request.QueryString("id")))
		Dim ht As New Hashtable()
		ht("refresh") = "yes"
		ht("message") = "Event deleted."
		Modal.Close(Me, ht)
		'ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "<script type='text/javascript'>setTimeout(function() { modal.close({refresh:'yes',message:'Event deleted'); }, 0);</script>", false);
	End Sub

	Protected Sub UpdatePanel_Load(ByVal sender As Object, ByVal e As EventArgs)
		'ScriptManager.RegisterStartupScript(this, this.GetType(), "modal", "<script type='text/javascript'>setTimeout(function() { modal.stretch(); }, 0);</script>", false);
	End Sub


End Class

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