Click here to Skip to main content
15,913,487 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: problem in session state please help me Pin
M LN Rao17-Nov-06 0:38
M LN Rao17-Nov-06 0:38 
GeneralRe: problem in session state please help me Pin
scorpion_man198217-Nov-06 1:09
scorpion_man198217-Nov-06 1:09 
QuestionHow get MouseUp event of vertical scroll bar of browser. Pin
Parwej Ahamad17-Nov-06 0:12
professionalParwej Ahamad17-Nov-06 0:12 
Questionlabel width change Pin
ayeleteric16-Nov-06 23:57
ayeleteric16-Nov-06 23:57 
AnswerRe: label width change Pin
ayeleteric17-Nov-06 22:09
ayeleteric17-Nov-06 22:09 
Questiononfocus event handler for text box Pin
Krishlibran16-Nov-06 23:49
Krishlibran16-Nov-06 23:49 
AnswerRe: onfocus event handler for text box Pin
ayeleteric17-Nov-06 0:01
ayeleteric17-Nov-06 0:01 
QuestionPassing objects forth and back between ASP.NET pages. Pin
MY120116-Nov-06 23:47
MY120116-Nov-06 23:47 
Hi there.

I'm currently creating a site which behaves like a kind of "wizard". So I need to pass objects forth and back between the pages in the wizard. Now this works fine passing objects forth, but I have a problem passing objects back or have the page remembering objects between post backs.

Here's some example code:

private MyObject _myObject;

protected void Page_Load(object sender, EventArgs e)
{
    // Context.Items["MyObject"] has been set by another page.
    // An passed on using Server.Transfer()
    _myObject = (MyObject)Context.Items["MyObject"];

    _myObject.MyString = "Hello";
}

protected void Button1_Click(object sender, EventArgs e)
{
    MyObjects.SaveMyObject(_myObject);
}


Here's my problem:
On my web form I have a button which calls "Button1_Click". Whenever this method is called I get a "NullReferenceException" from SaveMyObject - obviously because _myObject is null. But why? In the Page_Load method setting the MyString property to "Hello" works just fine.

So my guess is that the page "forgets" the content of the context object between post backs. I guess I need to do something else. Is there some kind of solution to this problem?

Best regards
Soeren
AnswerRe: Passing objects forth and back between ASP.NET pages. Pin
M LN Rao17-Nov-06 0:42
M LN Rao17-Nov-06 0:42 
AnswerRe: Passing objects forth and back between ASP.NET pages. Pin
l0kke17-Nov-06 0:44
l0kke17-Nov-06 0:44 
QuestionGet value from control Pin
alimohammed16-Nov-06 23:45
alimohammed16-Nov-06 23:45 
AnswerRe: Get value from control Pin
ayeleteric17-Nov-06 0:02
ayeleteric17-Nov-06 0:02 
GeneralRe: Get value from control Pin
alimohammed17-Nov-06 0:52
alimohammed17-Nov-06 0:52 
GeneralRe: Get value from control [modified] Pin
ayeleteric17-Nov-06 21:50
ayeleteric17-Nov-06 21:50 
Questionwant a help in asp.net Pin
amit_iper916-Nov-06 23:44
amit_iper916-Nov-06 23:44 
AnswerRe: want a help in asp.net Pin
ednrgc17-Nov-06 3:36
ednrgc17-Nov-06 3:36 
QuestionASP.NET Design / Source problems? Pin
wbjohnson16-Nov-06 23:17
wbjohnson16-Nov-06 23:17 
QuestionHttphandler works intermittently Pin
s2111979216-Nov-06 23:07
s2111979216-Nov-06 23:07 
Question.txt file download Pin
Nagraj Naik16-Nov-06 22:52
Nagraj Naik16-Nov-06 22:52 
QuestionIIS problem & solution yet its not working Pin
K edar V16-Nov-06 22:49
K edar V16-Nov-06 22:49 
AnswerRe: IIS problem & solution yet its not working Pin
K edar V16-Nov-06 22:54
K edar V16-Nov-06 22:54 
QuestionABOUT REPORTVIEWER IN ASP.NET2005 Pin
BINOVAR16-Nov-06 22:17
BINOVAR16-Nov-06 22:17 
QuestionSave as window pop up problem? Pin
cheeken2u16-Nov-06 22:03
cheeken2u16-Nov-06 22:03 
AnswerRe: Save as window pop up problem? Pin
Pavan Naidu16-Nov-06 22:18
Pavan Naidu16-Nov-06 22:18 
GeneralRe: Save as window pop up problem? Pin
cheeken2u16-Nov-06 22:33
cheeken2u16-Nov-06 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.