protected void btnSave_Click(object sender, EventArgs e) { Whitelist whitelist = new Whitelist(); if (divWhitelist.Visible != true) { whitelist.add(txtReason.Text, Convert.ToDateTime(from.Text), Convert.ToDateTime(to.Text), 0, Convert.ToInt32(ddlWorkstation.SelectedValue)); lblText.Text = "<br />Record inserted successfully<br />"; divForm.Visible = false; txtReason.Text = ""; from.Text = ""; to.Text = ""; } else { whitelist.edit(Convert.ToInt32(lbl.Text), txtReason.Text, Convert.ToDateTime(from.Text), Convert.ToDateTime(to.Text), 0, Convert.ToInt32(ddlWorkstation.SelectedValue)); lblText.Text = "<br />Record modified successfully<br />"; divForm.Visible = false; divWhitelist.Visible = false; lbl.Text = ""; gvWhitelists.EditIndex = -1; } // Bind the GridView control to the courseInfo collection. gvWhitelists.DataSource = whitelist.load(); gvWhitelists.DataBind(); btnInsert.Visible = true; }