How does jQuery Gantt package create a new ASP.NET project

roffey 2020-11-11 16:39:34
jquery gantt package create new

jQuery Gantt Package It's a real cross platform , be based on HTML5 / jQuery Local implementation of , have 2 Different gantt The widget , Can satisfy you all based on gantt Visual requirements of . Also with ASP.NET WebControl and MVC Expand , It can be easily integrated into existing applications .

Click to download jQuery Gantt Package Trial version

VS 2012 :FILE --> New --> Project --> Visual C# --> Web --> ASP.NET Web Forms Application, Create a project .
VS 2010 :FILE --> New --> Project --> Visual C# --> Web --> ASP.NET Web Application, Create a project .

1) Gant widget source code JS file

First , You need what the Gantt widget needs JS Source file . These documents are < The installation path >/Src In the folder . Copy this folder to the Project In the folder ( Although the size of this folder is very large , But it contains everything Themes、locales Wait for what you need CSS etc. , Not all CSS Will be loaded into your page ).

Continue to delete this Src In a folder bin Folder .

Then click in the solution explorer of the project " Display all files " Toolbar item to display the newly included Src Folder , And include it in the project .


2) practical JS Sample documents

Some with practical functions JS The file in < The installation path >/Samples/ In the script folder . Put the... In the above installation path Scripts The contents of the folder are copied to... In the project folder Scripts In the folder ( When you create a new project , The project folder will automatically create a Scripts Folder ).

Then follow the steps in the previous step to include the newly added script file into your project .

3) Create a sample data source (JSON data )

You usually use solid models 、ADO.NET To retrieve data from a database . however , To keep it simple , We will create a simple " Mission " list , And return it from the server to the client .

Create a file called TaskInfo To represent a task instance . stay Solution Explorer Right click the project name , Then add --> New projects --> class ( Call it TaskInfo.cs), And define a class similar to the following .

public class TaskInfo
public string Name { get; set; }
public int IndentLevel { get; set; }
public DateTime StartTime { get; set; }
public string Effort { get; set; }
public double ProgressPercent { get; set; }
public string Resources { get; set; }
public int ID { get; set; }
public string PredecessorIndices { get; set; }
public int SortOrder { get; set; }
public string Description { get; set; }
public object Tag { get; set; }
public int Priority { get; set; }
public DateTime PlannedStartTime { get; set; }
public DateTime PlannedEndTime { get; set; }
public double Cost { get; set; }
public DateTime EndTime { get; set; }

then , Add a new general handler to the project ; This will provide the data source for the client page .

To be in visual studio Add a Generic handler, stay Solution Explorer Right click the project name , then Add --> New Item --> Generic Handler, And create a new instance , I'm going to call it , for example DataHandler.ashx.

In the general handler (DataHandler.ashx) Create a TaskInfos list , Use JavaScriptSerializer Or any other "JSON Serializer " Convert the list to json data , And add it to the response .

public class DataHandler : IHttpHandler
DateTime dt = DateTime.Today;
public void ProcessRequest(HttpContext context)
List<TaskInfo> taskItems = new List<TaskInfo>
new TaskInfo { Name = "Task 1", ID = 1, StartTime =dt, Effort=TimeSpan.FromDays(1).ToString(), Description = "Description of Task 1" },
new TaskInfo { Name = "Child Task 1", ID = 2,IndentLevel=1, StartTime =dt, Effort=TimeSpan.FromDays(2).ToString(), Description = "Description of Task 2" },
new TaskInfo { Name = "Task 3", ID = 3, StartTime =dt, Effort=TimeSpan.FromDays(4).ToString(), Description = "Description of Task 3" },
new TaskInfo { Name = "Child Task 1", ID = 4,IndentLevel=1, StartTime =dt, Effort=TimeSpan.FromDays(3).ToString(), Description = "Description of Task 4" },
new TaskInfo { Name = "Child Task 2", ID = 5, IndentLevel=2, StartTime =dt, Effort=TimeSpan.FromDays(1).ToString(), Description = "Description of Task 5" },
new TaskInfo { Name = "Task 6", ID = 6, StartTime =dt, Effort=TimeSpan.FromDays(2).ToString(), Description = "Description of Task 6" },
new TaskInfo { Name = "Task 7", ID = 7, StartTime =dt, Effort=TimeSpan.FromDays(1).ToString(), Description = "Description of Task 7" },
new TaskInfo { Name = "Child Task 1", ID = 8,IndentLevel=1, StartTime =dt, Effort=TimeSpan.FromDays(2).ToString(), PredecessorIndices="6+2" }
System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
public bool IsReusable
return false;

4) That contains the Gantt chart widget ASPX file .

establish .aspx Sample file

stay visual studio Of SolutionExplorer Right click the project name , Then add --> New projects -->Web Form( be called WebForm1.aspx).

In the created aspx Contains the following namespace .

<%@ Register Assembly="RadiantQ.Web.JQGantt" Namespace="RadiantQ.WebForms.JQGantt" TagPrefix="RQ" %>.

add to RadiantQ.Web.JQGantt.dll To your project reference , You can find... Here dll.< Installation folder >/Src/\bin/DotNET4MVC4/RadiantQ.Web.JQGantt.dll.

stay aspx Of <head> The following source files are referenced in the tag . Remember to link to the correct version of... In the last line of reference below RadiantQ jQuery Gantt.


<head runat="server">
<link id="themeChooser" href="<%= Page.ResolveClientUrl("~/Src/Styles/jQuery-ui-themes/smoothness/jquery-ui.css") %>" rel="stylesheet" />
<link id="default" href="<%= Page.ResolveClientUrl("~/Src/Styles/radiantq.gantt.default.css") %>" rel="stylesheet" />
<link href="<%= Page.ResolveClientUrl("~/Src/Styles/VW.Grid.css") %>" rel="stylesheet" />
<script src="<%= Page.ResolveClientUrl("~/Src/Scripts/jquery-1.11.2.min.js") %>" type="text/javascript"></script>
<script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Src/Scripts/jquery-ui-1.11.4/jquery-ui.min.js") %>"></script>
<script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Src/Scripts/jquery.layout-latest.min.js") %>"></script>
<script src="<%= Page.ResolveClientUrl("~/Src/Scripts/Utils/date.js") %>" type="text/javascript"></script>
<script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Src/ResourceStrings/en-US.js") %>"></script>
<script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Src/Scripts/VW.Grid.1.min.js") %>"></script>
<script type="text/javascript" src="<%= Page.ResolveClientUrl("~/Src/Scripts/RadiantQ-jQuery.gantt.5.0.trial.min.js") %>"></script>
<script src="<%= Page.ResolveClientUrl("~/Src/Scripts/RQGantt_Init.min.js")%>" type="text/javascript"></script>


Create Gantt Chart

Now include the code to retrieve the... Created above json file , Then initialize GanttControl Small components , Bind it to the loaded data .

stay WebForm1.aspx in , stay <body> Default in <form> In the label , Add the following tag .


<form id="form1" runat="server">
<RQ:GanttControl ID="gantt" DataSourceUrl="DataHandler.ashx" Height="500px" runat="server"/>


Initialize Gantt Chart
Now? , You have to set what you want in GanttTable The different columns shown in , You can use the GanttControl Of GanttTableOptions Property to implement . You can use the GanttControl Of GanttTableOptions Property to implement .

<RQ:GanttControl ID="gantt" DataSourceUrl="DataHandler.ashx" Height="500px" runat="server">
<GanttBase:Column field="Activity.ID" width="25" title="ID" iseditable="false"></GanttBase:Column>
<GanttBase:Column field="Activity.ActivityName" width="200" title="Activity Name" clientTemplate="projectGanttNameTemplate" clientEditorTemplate="projectGanttNameEditor"></GanttBase:Column>
<GanttBase:Column field="Activity.StartTime" width="100" title="StartTime" format="MM/dd/yy" clientEditorTemplate="startTimeEditor"></GanttBase:Column>
<GanttBase:Column field="Activity.EndTime" width="100" title="EndTime" format="MM/dd/yy" clientEditorTemplate="endTimeEditor"></GanttBase:Column>
<GanttBase:Column field="Activity.Effort" width="100" title="Effort" format="" clientEditorTemplate="effortEditor"></GanttBase:Column>
<GanttBase:Column field="Activity.ProgressPercent" width="100" title="ProgressPercent" clientEditorTemplate="progressEditor"></GanttBase:Column>
<GanttBase:Column field="Activity.Assignments" width="100" title="Resource" iseditable="false" clientTemplate="resourceTemplate"></GanttBase:Column>
<GanttBase:Column field="Activity.PredecessorIndexString" width="100" title="Predecessor Index" clientEditorTemplate="predecessorEditor" clientTemplate="predecessorTemplate" isParentEditable="false"></GanttBase:Column>
<%-- Column Template--%>
<script id="projectGanttNameTemplate" type="text/x-jquery-tmpl">
<div class="rq-grid-expand-indentWidth" style="height: 1px; width: ${data.IndentWidth_M()}px"></div>
<div style="width: 12px; display: ${data.IsParent_M() ? "block" :"none" }" class="arrowContainer">
<div onclick="ExpanderOnclick(this,event)" id="Div2" class="${ data.IsExpanded_M() ? " rq-grid-expand-arrow rq-grid-collapse-arrow": "rq-grid-expand-arrow"} rq-Ignore-click"></div>
<div class="rq-grid-expander-text">${data.Activity.ActivityName}</div>
<script id="predecessorTemplate" type="text/x-jquery-tmpl">
<div>${data.PredecessorIndexString_M() || '' }</div>
<%--Column Editors --%>
<script id="startTimeEditor" type="text/x-jquery-tmpl">
<input data-bind='ActivityTimeBinder: Activity_M().StartTime_M' />
<script id="endTimeEditor" type="text/x-jquery-tmpl">
<input data-bind='value: Activity_M().EndTime_M' data-getvaluename='getDate' data-setvaluename='setDate' data-valueupdate='onBlur' data-role="DateTimePicker" />
<script id="effortEditor" type="text/x-jquery-tmpl">
<input data-bind='value: Activity_M().Effort_M' data-role="DurationPicker" />
<script id="progressEditor" type="text/x-jquery-tmpl">
<input data-bind='value: Activity_M().ProgressPercent_M' data-role="spinner" data-options='{"min":0, "max": 100}' />
<script id="predecessorEditor" type="text/x-jquery-tmpl">
<input data-bind='value: PredecessorIndexString' />

gantt Now it's completely set up , Can display from ashx The task returned by the handler .

take WebForm1.aspx Set to " The start page ". You can do this by right clicking the file in solution explorer and selecting " Set to start page " To achieve .

Here's the final Gantt Chart :


Related product introduction :

VARCHART XGantt Support ActiveX、.Net Equal platform C# Gantt chart control
AnyGantt Ideal tool for building complex and rich Gantt charts
phGantt Time Package A Gantt chart for the management of assignments and time
dhtmlxGantt Interactive JavaScript / HTML5 Gantt Chart

APS It's Huidu technology 15 Years of industry experience and technology precipitation , By connecting enterprises to receive orders 、 purchase 、 manufacture 、 The whole supply chain process, such as warehousing and logistics , Help to improve the production efficiency of enterprises .>> see APS Details

Want to buy a genuine Gantt chart license , Or for more product information, please click 【 Consult online customer service 】


  1. [front end -- JavaScript] knowledge point (IV) -- memory leakage in the project (I)
  2. This mechanism in JS
  3. Vue 3.0 source code learning 1 --- rendering process of components
  4. Learning the realization of canvas and simple drawing
  5. gin里获取http请求过来的参数
  6. vue3的新特性
  7. Get the parameters from HTTP request in gin
  8. New features of vue3
  9. vue-cli 引入腾讯地图(最新 api,rocketmq原理面试
  10. Vue 学习笔记(3,免费Java高级工程师学习资源
  11. Vue 学习笔记(2,Java编程视频教程
  12. Vue cli introduces Tencent maps (the latest API, rocketmq)
  13. Vue learning notes (3, free Java senior engineer learning resources)
  14. Vue learning notes (2, Java programming video tutorial)
  15. 【Vue】—props属性
  16. 【Vue】—创建组件
  17. [Vue] - props attribute
  18. [Vue] - create component
  19. 浅谈vue响应式原理及发布订阅模式和观察者模式
  20. On Vue responsive principle, publish subscribe mode and observer mode
  21. 浅谈vue响应式原理及发布订阅模式和观察者模式
  22. On Vue responsive principle, publish subscribe mode and observer mode
  23. Xiaobai can understand it. It only takes 4 steps to solve the problem of Vue keep alive cache component
  24. Publish, subscribe and observer of design patterns
  25. Summary of common content added in ES6 + (II)
  26. No.8 Vue element admin learning (III) vuex learning and login method analysis
  27. Write a mini webpack project construction tool
  28. Shopping cart (front-end static page preparation)
  29. Introduction to the fluent platform
  30. Webpack5 cache
  31. The difference between drop-down box select option and datalist
  32. CSS review (III)
  33. Node.js学习笔记【七】
  34. Node.js learning notes [VII]
  35. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  36. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  37. 【JQuery框架,Java编程教程视频下载
  38. [jQuery framework, Java programming tutorial video download
  39. Vue Router根据后台数据加载不同的组件(思考-&gt;实现-&gt;不止于实现)
  40. Vue router loads different components according to background data (thinking - & gt; Implementation - & gt; (more than implementation)
  41. 【Vue,阿里P8大佬亲自教你
  42. 【Vue基础知识总结 5,字节跳动算法工程师面试经验
  43. [Vue, Ali P8 teaches you personally
  44. [Vue basic knowledge summary 5. Interview experience of byte beating Algorithm Engineer
  45. 【问题记录】- 谷歌浏览器 Html生成PDF
  46. [problem record] - PDF generated by Google browser HTML
  47. 【问题记录】- 谷歌浏览器 Html生成PDF
  48. [problem record] - PDF generated by Google browser HTML
  49. 【JavaScript】查漏补缺 —数组中reduce()方法
  50. [JavaScript] leak checking and defect filling - reduce() method in array
  51. 【重识 HTML (3),350道Java面试真题分享
  52. 【重识 HTML (2),Java并发编程必会的多线程你竟然还不会
  53. 【重识 HTML (1),二本Java小菜鸟4面字节跳动被秒成渣渣
  54. [re recognize HTML (3) and share 350 real Java interview questions
  55. [re recognize HTML (2). Multithreading is a must for Java Concurrent Programming. How dare you not
  56. [re recognize HTML (1), two Java rookies' 4-sided bytes beat and become slag in seconds
  57. 【重识 HTML ,nginx面试题阿里
  58. 【重识 HTML (4),ELK原来这么简单
  59. [re recognize HTML, nginx interview questions]
  60. [re recognize HTML (4). Elk is so simple