Imran Bashir

Imran Bashir

  • NA
  • 186
  • 13.6k

pass value from one page to other

Jul 27 2016 8:49 AM
Hello guys i'm using the session to pass value from one page to other i have two page one is sale and one is purchase these value response.redirect(ledger.aspx) page  and here i can save value in textbox but when i visit both of these page session both of them have been create and in  ledger page if condition  fails to check the last request of page becoz both of them have session ..kindly tell me how do i can check if condition only work on last page request
 
Session["SaleInfo"]
Session["PurchaseInfo"] 
====================here is the code ================================
protected void Page_Load(object sender, EventArgs e)
{
dbclass db = new dbclass();
//TxtPartyId.Text = Request.QueryString.ToString();
string p;
string s;
int temp = 0;

if (Session["SaleInfo"] != null)
{
s = Session["SaleInfo"].ToString();
temp = 1;

}
else if (Session["purchaseInfo"] != null)
{
p = Session["purchaseInfo"].ToString();
temp = 2;
}
switch (temp)
{
case 1:

TxtVoucherID.Text = Session["SaleID"].ToString();
string id = Session["PartID"].ToString();
TxtPartyId.Text = Session["PartName"].ToString();
txtTotalAmount.Text = Session["TotalAmount"].ToString();
txtPaid.Text = Session["Paid"].ToString();
txtBlance.Text = Session["Balance"].ToString();
txtDate.Text = Session["SaleDate"].ToString();
break;

case 2:

TxtVoucherID.Text = Session["PurchaseID"].ToString();
string id2 = Session["PartID"].ToString();
TxtPartyId.Text = Session["PartName"].ToString();
txtTotalAmount.Text = Session["TotalAmount"].ToString();
txtPaid.Text = Session["Paid"].ToString();
txtBlance.Text = Session["Balance"].ToString();
txtDate.Text = Session["PurchaseDate"].ToString();
break;


Answers (1)