Click here to Skip to main content
15,900,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
master page


C#
OrdrInfo ordinfo = (OrdrInfo)Session["addtocartlist"]; // OrdrInfo is class where i have arraylist.
shopCarInfor(ordinfo);

public void shopCarInfor(OrdrInfo order)
{

Session["addtocartlist"] = order;
}


//till now there is no problem. .

///child page:

protected void c1_row_command(object sender, C1GridViewCommandEventArgs e) // when this function calls using command name 
{
if (e.CommandName.ToLower() == "delete")
{
// i am deleting particulars and binding into class
OrdrInfo model = (OrdrInfo)Session["addtocartlist"];

}
//there is some needed that i need to update class value from child page to master pager 
//so, i called like below,
project.MasterPage.Site1 objsite = new MasterPage.Site1();

objsite.shopCarInfor(model);

}

//this objsite.shopCarInfor(model); calls correctly which is in master page also i am getting //value here

public void shopCarInfor(OrdrInfo order) // i am getting value in order
{

Session["addtocartlist"] = order; // when initializing order to session , i am getting error like "Object reference not set to an instance of an object".

}

how to solve this problem? help needed.
Posted
Updated 26-May-14 23:48pm
v3
Comments
Bh@gyesh 27-May-14 5:49am    
on which line u get error?

1 solution

Hi,

I don't know why you are creating new instance of you master page.

you can call it call the same as

C#
Master.[Your function]


you must specify the master page

<%@ MasterType virtualpath="~/Masters/Master1.master" %>


For more information on Master Page : http://msdn.microsoft.com/en-us/library/vstudio/xxwa0ff0(v=vs.100).aspx[^]

I did not saw any erroneous code but you post the both master and content page then I more clear to understand.
 
Share this answer
 

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