I am writing a page in ASP.NET and I am having problems after the initialization loop during postbacks:
I have (something similar) the following:
public partial class MyClass : System.Web.UI.Page
{
String myString = "default";
protected void Page_Init(object o, EventArgs e)
{
myString = Request["passedString"];
}
protected void Page_Load(object o, EventArgs e)
{
if(!Postback)
{
}
else
{
}
}
}
And what happens is that my code types “pastString” just fine, but for some reason, when posting back, it is reset to the default value - even if I put the default destination in the Page_Init code ... which makes me wonder what is going on.
Any help?
source
share