Click here to Skip to main content
15,900,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
In registration page after inserting values into database i send the details to that user mail id and then i need to through a message like registered successfully and it will redirect to another page.

How can i done this?

here is my code


C#
Session["plan"] = "6 Months Pack";
int view = 1;
Session["viewedd"] = view.ToString();
int res = ob_dal.registration(txtmername.Text, txtlogname.Text, "", "", txtaddr.Text, txtzipcode.Text, "", txtpho.Text, "", txtemail.Text, txtpwd.Text, rdbtnplan.SelectedItem.Value, "", Convert.ToDateTime(start_date), Convert.ToDateTime(end_date), txtfname.Text, txtlname.Text, txtcompname.Text, txtcomsite.Text, logo_img, "No");

if (res > 0)
{
  lblMsg.Visible = true;
  //lblMsg.Text = "Registered Successfully";
  Page.ClientScript.RegisterStartupScript(this.GetType(), "msg", "<script>alert('Registered  Successfully')</script>");
}
int SendMail = ob_dal.sent_mail(un, locpwd, locmail);
Response.Redirect(@"https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=marlen@gmail.com&amount=" + 40 + "");
Posted
Updated 15-Dec-11 0:12am
v5

This could be used for selecting random name from the table...this could not perfectly match of your desire...but try like this...
private void timer1_Tick(object sender, EventArgs e)
{
try
{
label1.Text = DateTime.Now.ToLongTimeString();
cn.Open();
SqlDataAdapter da = new SqlDataAdapter("select*from client", cn);
DataSet ds = new DataSet();
DataTable dt = new DataTable();
da.Fill(dt);
dataGridView1.DataSource = dt;
cn.Close();
if (textBox1.Text == null && textBox2.Text == null && richTextBox1.Text == null)
{
MessageBox.Show("no task allocated");
}
else
{
try
{
//here using cro algorithm
Random RandomNumber = new Random();

int rand;
int r = int.Parse(label5.Text.ToString());
rand = RandomNumber.Next(0, r);
string ip = listBox2.Items[rand].ToString();
//TcpClient socket = new TcpClient("192.168.1.56", 1095);

TcpClient socket = new TcpClient(ip, 1095);
NetworkStream nw = socket.GetStream();
cn.Open();
SqlCommand cd1 = new SqlCommand("update task1 set task='" + richTextBox1.Text + "',assigned=getdate(),deadline=getdate()+10 where ip='" + ip + "'", cn);
cd1.ExecuteNonQuery();
cn.Close();
}
catch (Exception ep)
{
// MessageBox.Show(ep.ToString();
}
 
Share this answer
 
Hi,

you can add below javascript code in head section

function Success(pageName) {
debugger;
alert('Success mesg');
// your page name
window.location = pageName;
}



add below code into code file after database insert process:

Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "Success('your Page Name')", true);

you will get Sucess message then it will redirect to requested page.
 
Share this answer
 
For redirecting you have to use

Eg:

C
Response.Redirect("lstBx.aspx");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900