Click here to Skip to main content
16,011,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello sir,

how to pass value of one view to another view of multipuleview.

i use session to pass one value of view to another view but when pass the value in page load than i get error "object not found".

i done it,like that

in 1st view

C#
a = drpPackages.SelectedItem.Text;
        b =Convert.ToInt32(txtNoOfDay.Text);
        Session["package"] = a;
        Session["no_of_day"] = b;

in page_load i pass that value into 2nd view where package and no of day are field.
C#
if (!IsPostBack)
        {
            ActiveDeActiveSteps();
       Session.Abandon();
        //Session.Contents.RemoveAll();
      
       
        if (Session["package"].ToString() == "" && Session["no_of_day"].ToString() == "")
        {

       }
        else
        {
         drpPak.SelectedItem.Text = Session["package"].ToString();
          txtDay.Text = Session["no_of_day"].ToString();

      }
        //}
Posted
Updated 31-Jan-12 0:00am
v2
Comments
Anuja Pawar Indore 31-Jan-12 6:00am    
Added pre tag

You can use QueryString. Check here

Passing variables between pages using QueryString[^]
 
Share this answer
 
change the checking to follow it may work fine
C#
if (Session["package"] != null && Session["no_of_day"] != null)
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 1-Feb-12 8:58am    
Added pre tag

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