Tutor HuntResources ASP DOT NET Resources
How To Show Confirmation Messagebox Before Insert Data Using Javascript?
Show Confirmation MessageBox Before Insert data using JavaScript?
Date : 21-09-2012
Author Information
Uploaded by : Deep
Uploaded on : 21-09-2012
Subject : ASP DOT NET
How to Show Confirmation MessageBox Before Insert data using Javascri pt?
In a `Submit` Button i am usign `OnClientClick` attribute to show Confirmation MessageBox as Follows:
OnClientClick="return confirm(`Are you sure, you want to Add this Record?`);"
This Confirmation MessageBox will display two button `Yes` and `No` with Text for user confiramtion.If the User clicks on `Yes" button the Record will Insert in a Table.If the user Clicks on `NO` button the Transaction will be Cancelled.
Double Click on your Submit Button and write the Insert command code to insert data as follows:
protected void btnsubmit_Click1(object sender, EventArgs e)
{
cmd = new OleDbCommand("insert into student(Name,Rollno) values(`" + textName.Text + "`," + txtID.Text + ")", conn);
cmd.ExecuteNonQuery();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "student");
GridView1.DataSource = ds.Tables["student"];
GridView1.DataBind();
textName.Text = "";
txtID.Text = "";
}
The Submit Button of Soucre code as below :-
1
This resource was uploaded by: Deep