Hi,
Currently i am doing Simple Project In asp.net (C#). In that I have 2 Forms.
In 1st Form i have 3 text boxes and a next button.
In 2nd Form i have 3 text boxes and a submit button.
My Question is: When i click the Next Button it should go to next
page and In second page when i click submit button both the form values
should be saved.
Pls Help me with this.....
Regards,
Ramu.k
Loading
Farooque AliPosted Mar 7, 2013, 2:26 AM
Store 3 text box values using session state. when redirect to second form, assign those session values of 3 text box into 3 variable, and get the current form 3 text box values. Then store all values using button click event function
Get back to me if you have any queries
ramu kPosted Mar 8, 2013, 6:25 AM
Thanks For the Answer. Got a solution..
Regards,
Ramu K
Satyapriya NayakPosted Mar 6, 2013, 10:22 PM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace First_second_next_save
{
public partial class FirstForm : System.Web.UI.Page
{
string url;
protected void Button1_Click(object sender, EventArgs e)
{
url = "SecondForm.aspx?name=" + txt_name.Text + "&email=" + txt_email.Text + "&mobileno=" + txt_mobile.Text + " ";
Response.Redirect(url);
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SecondForm.aspx.cs" Inherits="First_second_next_save.SecondForm" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace First_second_next_save
{
public partial class SecondForm : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
protected void btn_save_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "insert into employee values('" + txt_name.Text + "','" + txt_email.Text + "','" + txt_mobile.Text + "','" + txt_city.Text + "','" + txt_state.Text + "')";
com = new SqlCommand(str, con);
com.ExecuteNonQuery();
con.Close();
Response.Write("Records successfuly inserted");
}
protected void Page_Load(object sender, EventArgs e)
{
txt_name.Text = Request.QueryString["name"];
txt_email.Text = Request.QueryString["email"];
txt_mobile.Text = Request.QueryString["mobileno"];
}
}
}