Click here to Skip to main content
15,174,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am writing a Login page for customer, after login it will display all customer data on the next page.
i am using sessions. its working but only with transfer id and other items are not transfered.
i am writing the code below. So, please find error and give me the idea to solve this problem....

C#
string cuser_id = TextBox1.Text;
            balcon obj1 = new balcon();
            string ckkk = obj1.dataaccount(cuser_id).ToString();
            if (ckkk == " Sorry No Id Found")
            {
                Label1.Text = "Sorry no id found";
            }
            else
            {
                Session["aaa"] = cuser_id.ToString();
                Response.Redirect("customer.aspx");
            }


2 nd page code is


C#
account_details obj5 = new account_details();
           obj5.Account_id = (int32)Session["aaa"];
           obj5.Account_id = TextBox1.Text;
           obj5.Name = TextBox2.Text;
           obj5.Join_date = TextBox3.Text;
           obj5.Balance = TextBox4.Text;
Posted
Updated 2-Jul-12 21:52pm
v6
Comments
bhagirathimfs 3-Jul-12 2:01am
   
What do you want to do?
Session["aaa"] will give you what you have entered in the TextBox1 of first page.
bhagirathimfs 3-Jul-12 2:02am
   
other items not transfer.
Means?
Which other items you want to be transferred?
Shemeer NS 3-Jul-12 2:21am
   
You can get the cutomer details in second page using the cuser_id, so what's your real problem,please clarify
Yatin chauhan 3-Jul-12 2:22am
   
You store cuser_id in session["aaa"]. so when u call the session in other page it only display cuser_id in other page. plz store all the data which u want to transfer in next page. then call the session["aaa"] in other page.
arun.m.mr 3-Jul-12 2:24am
   
Hi raju,
Here it only transfer customer id because you use only one session variable. Session["aaa"] = cuser_id.ToString();

If u need further more details, use the session value in the second page to retrieve data from database or some where else where you stored data.

Thank you.

Please read the basic of Session from MSDN. Please check the below links this will help you.

http://msdn.microsoft.com/en-us/library/ms178581.aspx[^]

http://msdn.microsoft.com/en-us/library/ms972429.aspx[^]
   
First of all, this question is not clear. It will be better to get help from someone who can handle English in a better way.

Then, If you want to pass only cuser_id and you want the value of this only in the destination page, better use Query-String[^].

C#
obj5.Account_id = Session["aaa"].ToString();
obj5.Account_id = TextBox1.Text;


In the above code, remove the second line as it overwrites the obj5.Account_id.

Regards
Sebastian
   
v2
In your 1st page

C#
string qid = "121";
Session["QueryString"] = qid;



To receive the data in the 2nd page use
perWorkId = Convert.ToString(Session["QueryString"]);
   

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