// Updating a event protected void gvwDash_RowUpdating(object sender, GridViewUpdateEventArgs e) { string eventId = ((Label)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtEventId")).Text; string eventSchedule = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtSchedule")).Text; string eventLocation = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtLocation")).Text; string eventPrice = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtPrice")).Text; string eventStartDttm = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtStartDttm")).Text; string eventEndDttm = ((TextBox)gvwCourseEvents.Rows[e.RowIndex].FindControl("txtEndDttm")).Text; // update event start BIZCourseDataSet eventDS = _bc.getEventDataSetById(eventId); BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow eventRow = (BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow)eventDS.T_BIZ002_COURSE_EVENT.Rows[0]; eventRow.SCHEDULE = eventSchedule; eventRow.LOCATION = eventLocation; eventRow.PRICE = eventPrice; eventRow.START_DTTM = DateTimeUtil.parseToDateTime(eventStartDttm); eventRow.END_DTTM = DateTimeUtil.parseToDateTime(eventEndDttm); _bc.UpdateTable(eventDS.T_BIZ002_COURSE_EVENT); // end of add new event gvwCourseEvents.EditIndex = -1; // Rebind Grid view this.EventDataBind(); }
// Adding new Event protected void AddNewEvent(object sender, EventArgs e) { string eventSchedule = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewSchedule")).Text; string eventLocation = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewLocation")).Text; string eventPrice = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewPrice")).Text; string eventStartDttm = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewStartDttm")).Text; string eventEndDttm = ((TextBox)gvwCourseEvents.FooterRow.FindControl("txtNewEndDttm")).Text; // below to add new event string courseId = ViewState["CourseId"].ToString(); BIZCourseDataSet courseDS = new BIZCourseDataSet(); BIZCourseDataSet.T_BIZ002_COURSE_EVENTRow courseRow = courseDS.T_BIZ002_COURSE_EVENT.NewT_BIZ002_COURSE_EVENTRow(); courseRow.COURSEEVENTID = Utility.NewDataKey(); courseRow.COURSEID = courseId; courseRow.SCHEDULE = eventSchedule; courseRow.LOCATION = eventLocation; courseRow.PRICE = eventPrice; courseRow.START_DTTM = DateTimeUtil.parseToDateTime(eventStartDttm); courseRow.END_DTTM = DateTimeUtil.parseToDateTime(eventEndDttm); Utility.UpdateCommonFields(courseRow); courseDS.T_BIZ002_COURSE_EVENT.AddT_BIZ002_COURSE_EVENTRow(courseRow); _bc.UpdateTable(courseDS.T_BIZ002_COURSE_EVENT); // end of add new event // Rebind Grid view this.EventDataBind(); }