Click here to Skip to main content
15,919,121 members

Comments by sharad Pyakurel (Top 1 by date)

sharad Pyakurel 19-Mar-12 7:05am View    
Deleted
Your Question is not clear. But, I think you should do like

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;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add(new System.Data.DataColumn("Name", typeof(String)));
dt.Columns.Add(new System.Data.DataColumn("Address", typeof(String)));
dt.Columns.Add(new System.Data.DataColumn("Cell", typeof(String)));
Session["CurrentData"] = dt;
}
}

protected void btnSave_Click(object sender, EventArgs e)
{
((DataTable)Session["CurrentData"]).Rows.Add(TextBox1.Text, TextBox2.Text, TextBox3.Text);
clearfields();
}

private void clearfields()
{
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}

protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Default3.aspx");
}

}
}