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();
} |
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
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.
|