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. Image for the cookie policy date

scheduleControl sql my form

Hi
1. I need to run my Form301
and perform operations add delete change
on dstest007ce.Tables ["ScheduleData"];
2. how to connect it to gridGroupingControl1 so that the changes are visible after each change

Regards,
Gregory

Attachment: c_test2c_d414cfb0.rar

3 Replies

AR Arulpriya Ramalingam Syncfusion Team November 21, 2019 09:01 AM UTC

Hi Gregory, 
 
Thank you for using Syncfusion support. 
 
The GridGroupingControl control does not have support to add records programmatically at run time. However, it updates the records whenever the binding source is updated and we would suggest you to add/delete the rows from the binding source dstest007ce.Tables[“ScheduleData”] to reflect the changes in Grid. Please make use of the below code to update the records in datatable. 
 
Code example 
 
private void ADD_button_Click(object sender, EventArgs e) 
{ 
 
    // Obtain a new DataRow object from the DataTable. 
    drCurrent = table.NewRow(); 
 
    // Set the DataRow field values as necessary. 
    drCurrent["EndTime"] = this.EndTime_dateTimePicker.Value; 
    drCurrent["LocationValue"] = this.LocationValue_textBox.Text; 
    drCurrent["StartTime"] = this.StartTime_dateTimePicker.Value; 
    drCurrent["Subject"] = this.Subject_textBox.Text; 
    //Code to set values for all the columns. 
    table.Rows.Add(drCurrent); 
} 
 
private void DELETE_button_Click(object sender, EventArgs e) 
{ 
    string key = this.Subject_textBox.Text; 
    drCurrent = table.Rows.Find(key); 
    drCurrent.Delete(); 
} 
 
 
Note: Ensure to add the UniqueID as primarykey and get the id when Delete button clicked. 
 
Arulpriya 



GP Gregory Pe replied to Arulpriya Ramalingam November 21, 2019 10:24 AM UTC

Hi Gregory, 
 
Thank you for using Syncfusion support. 
 
The GridGroupingControl control does not have support to add records programmatically at run time. However, it updates the records whenever the binding source is updated and we would suggest you to add/delete the rows from the binding source dstest007ce.Tables[“ScheduleData”] to reflect the changes in Grid. Please make use of the below code to update the records in datatable. 
 
Code example 
 
private void ADD_button_Click(object sender, EventArgs e) 
{ 
 
    // Obtain a new DataRow object from the DataTable. 
    drCurrent = table.NewRow(); 
 
    // Set the DataRow field values as necessary. 
    drCurrent["EndTime"] = this.EndTime_dateTimePicker.Value; 
    drCurrent["LocationValue"] = this.LocationValue_textBox.Text; 
    drCurrent["StartTime"] = this.StartTime_dateTimePicker.Value; 
    drCurrent["Subject"] = this.Subject_textBox.Text; 
    //Code to set values for all the columns. 
    table.Rows.Add(drCurrent); 
} 
 
private void DELETE_button_Click(object sender, EventArgs e) 
{ 
    string key = this.Subject_textBox.Text; 
    drCurrent = table.Rows.Find(key); 
    drCurrent.Delete(); 
} 
 
 
Note: Ensure to add the UniqueID as primarykey and get the id when Delete button clicked. 
 
Arulpriya 


Hi Arulpriya ,

Thank you for your answer

1. how to get information in Form301, what record should I edit after clicking (Edit Item menu) in scheduleControl1
to complete form 301.

2. when I set the scheduleControl1 view to "Dey"
and mark free e.g. 3 hours (date range)
and click (New Item menu) on scheduleControl1
how to get information in Form301 (date range) to complete the 301 form with dates I have chosen before
StartTime_dateTimePicker
EndTime_dateTimePicker

Regards,
Gregory


AR Arulpriya Ramalingam Syncfusion Team November 22, 2019 10:02 AM UTC

Hi Gregory, 
 
Thank you for the update. 
 
how to get information in Form301, what record should I edit after clicking (Edit Item menu) in scheduleControl1 
to complete form 301. 
e.Item of ShowingAppointmentForm will hold the values (start/End time, reminder value, etc.) of the appointment to be edited. Please refer to below KB to get item values. 
 
Code example 
 
void scheduleControl1_ShowingAppointmentForm(object sender, ShowingAppointFormEventArgs e) 
{ 
    //Cancel the default appointform for schedule control 
    e.Cancel = true; 
    //Shows the Custom appointment form 
    IScheduleAppointment appointment = e.Item; 
    //To parder the appointment 
    Form301 ChildForm = new Form301(appointment);        
    ChildForm.Show(); 
} 
public Form301(IScheduleAppointment appointment) 
{ 
    InitializeComponent(); 
    this.StartTime_dateTimePicker.Value = appointment.StartTime; 
    this.EndTime_dateTimePicker.Value = appointment.EndTime; 
    //Code for all the label and textboxes 
} 
 
2. when I set the scheduleControl1 view to "Dey" 
and mark free e.g. 3 hours (date range) 
and click (New Item menu) on scheduleControl1 
how to get information in Form301 (date range) to complete the 301 form with dates I have chosen before 
StartTime_dateTimePicker 
EndTime_dateTimePicker 
PerformNewItemClick() method of ScheduleGrid can be used to get the selected range of dates. Please refer forum for further reference. 
 
 
 
Please get back to us, if you have any other queries. 
 
Regards, 
Arulpriya 


Loader.
Up arrow icon