here is my code
ASPX Code:
<asp:Button ID="Button4" runat="server" onclick="Button4_Click" Text="Insert" />
C#:
public void MsgBox(String MessageToDisplay)
{
Label lblForMsg = new Label();
lblForMsg.Text = "<script language='javascript'>window.alert('" + MessageToDisplay + "')</script>";
Page.Controls.Add(lblForMsg);
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlCommand com = new SqlCommand("insert into employe values(@id,@pass)", con);
SqlParameter obj1 = new SqlParameter("@Id", DbType.StringFixedLength);
obj1.Value = TextBox4.Text;
com.Parameters.Add(obj1);
SqlParameter obj2 = new SqlParameter("@pass", DbType.StringFixedLength);
obj2.Value = TextBox5.Text;
com.Parameters.Add(obj2);
com.ExecuteNonQuery();
con.Close();
MsgBox("Account Created");
if (Session["regis"] == null)
{
Response.Redirect("Profile.aspx");
}
else
{
Response.Redirect("Login.aspx");
}
}
i want that when i click on button4, msgbox show, after that when i click ok on msgbox then it check the condition and response to the page.
i am using visual studio 2010,asp.net/c#