.Net with C#. Take values from one page to a new page
Posted on 2009-02-21
I have created a page where I get some values I save like this
String test = pnrTextBox.Text;
string output = pnr.IsValidFormat(test);
bool flag = pnr.isMale();
What i want is that the word woman or man will come to my next page. I thought ViewState.Add was used but it doensent work.
On the other page when I have clicked the ok button I get an error:
Check if the value is null or create new
I have writen like this to get the value out
protected void Page_Load(object sender, EventArgs e)
resultLabel.Text = ViewState["IsMale"].ToString();
Is this the wrong way to go? What is the correct way? How should I do it?
One thing u might need to know is that i have put PostBackUrl to the next page where the error happens. Does this mean that it doesnt go throw the code and just jump to the next page? And if it is like that what should I do so it first run the code and then takes me to the new page?