I am using the following code to delete the records from database.
protected void lnkDelete_Click(object sender, EventArgs e)
{
string id = ((sender as LinkButton).CommandArgument).ToString();
string constr = ConfigurationManager.ConnectionStrings["..."].ConnectionString;
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "Delete from UploadedFile where FileID=@FileID";
cmd.Parameters.AddWithValue("@FileID", id);
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
Response.Redirect(Request.Url.AbsoluteUri);
}
The delete link button will delete the record. I would like to add a pop-up window when user click on the delete button and ask them to type in password, if password correct then delete happen otherwise they could not delete the record. How could i do this either using JavaScript or code behind?