protected void btnSave_Click(object sender, EventArgs e) { try { classProvider.AddSchedule( Convert.ToInt32(ddlDayOfWeek.SelectedValue), Convert.ToInt32(ddlBranch.SelectedValue), Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(ddlMonth.SelectedValue), Convert.ToInt32(ddlClass.SelectedValue), ddlLevel.SelectedValue, Convert.ToInt32(ddlClassRoom.SelectedValue), ddlTimeStart.SelectedItem.Text.Split('-')[0], ddlTimeStart.SelectedItem.Text.Split('-')[1], Convert.ToInt32(ddlInstructor.SelectedValue)); gvwDetail.DataBind(); ddlTimeStart.SelectedIndex = 0; } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "_error", "alert('" + ex.Message + "')", true); } }