We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to control the startdate and enddate on add new task on Gantt control

Thread ID:

Created:

Updated:

Platform:

Replies:

121035 Nov 4,2015 02:14 PM UTC Nov 6,2015 12:12 PM UTC ASP.NET Web Forms 3
loading
Tags: Gantt
Dwayne Boykin
Asked On November 4, 2015 02:14 PM UTC

Hello,

How to control the startdate and enddate on add new task on Gantt control?

I cannot find a server event on Gantt control to allow me to grab the StartDate/EndDate textbox from code behind.

Thank you

Mahalakshmi Karthikeyan [Syncfusion]
Replied On November 5, 2015 06:30 PM UTC

Hi Dwayne,

We can control the start Date and End date while adding a new task and set the date returned from code behind using ActionComplete client side event. Please find the code example for details.

<ej:Gantt ID="Gantt" runat="server"

ActionComplete="ActionComplete">

<AddDialogFields>

              <ej:AddDialogField Field="Id" />

              <ej:AddDialogField Field="Name" />

              <ej:AddDialogField Field="PercentDont" />

          </AddDialogFields>

</ej:Gantt>  

function ActionComplete(args) {

                var ganttObj = $("#Gantt").data("ejGantt");


                if (args.requestType === 'save' && args.addedRecord) {

var ganttRecord = args.addedRecord.item;

                    if (args.addedRecord.parentItem)

                        ganttRecord["ParentId"] = args.addedRecord.parentItem.taskId;


                    $.ajax({

                        type: "POST",

                        url: "GanttSample.aspx/getDate",

                        contentType: "application/json; charset=utf-8",

                        dataType: "json",

                        success: function (result) {

                            ganttRecord.StartDate = result.d.startdate;

                            ganttRecord.EndDate = result.d.enddate;

                            PageMethods.AddIt(ganttRecord);

                            var obj = $("#Gantt").data("ejGantt");

                            obj.reRenderChart();

                        },

                        failure: function (response) {

                            alert(response.d);

                        }

                    })                 

                }

}


public class date

        {

            public string startdate { get; set; }

            public string enddate { get; set; }

        }


        [WebMethod]

        public static date getDate()

        {

            date gantt = new date();

            gantt.startdate = "02/27/2014";

            gantt.enddate = "02/29/2014";

            return gantt;

        }

We have also prepared a sample based on this and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/DateChange245361608

Regards,

Mahalakshmi K.


Dwayne Boykin
Replied On November 5, 2015 08:17 PM UTC

Thanks for your response.
 
Can you pre-populate the State/End date before save the task?
 
Your sample code is populate Start/End date while saving the task.
 
Thank you

Mahalakshmi Karthikeyan [Syncfusion]
Replied On November 6, 2015 12:12 PM UTC

Hi Dwayne,
At present there is no support to change the date at pre load time from server. Hence have logged usability feature regarding this. A support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates.
https://www.syncfusion.com/account/login?ReturnUrl=/support/directtrac/incidents
Please let us know if you require further assistance on this.    
Regards,
Mahalakshmi K.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;