Hi Kevin...haven't heard from you in a while.
Here is my relevant code from my derived page:
public class SqlPage : System.Web.UI.Page
{
protected override void LoadViewState( object savedState )
{
base.LoadViewState( savedState );
_Builder = ( SqlProcedureBuilder ) ViewState[
SqlProcedureBuilder.GetGuid() ];
if ( _Builder == null )
_Builder = new SqlProcedureBuilder();
_Builder.ConnectionString = SqlConnectionString;
}
protected override object SaveViewState()
{
//if ( !Builder.IsEmpty ) ************* <---
ViewState[ SqlProcedureBuilder.GetGuid() ] = _Builder;
return base.SaveViewState();
}
}
********
When I comment the line out, the derived classes LoadViewState is called, or
when the Builder is NOT empty it works. It seems ( I am probably wrong)
that if I don't adjust the ViewState in the SaveViewState method, the
LoadViewState method will not be called on the following postback.
bill
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:eG**************@TK2MSFTNGP09.phx.gbl...
Are you calling the Base class's LoadViewState in your override?
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"William F. Robertson, Jr." <wf*********@kpmg.com> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl... I am having difficulty in diagnosing this problem and was throwing it
out for some other eyes.
I have derived my own Page class from System.Web.UI.Page and have
overridden the LoadViewState method. I derive all of my application pages from my
own Page.
For some reason on two of my pages the LoadViewState derived method is
not firing and thus not setting up some of my controls on the page. On the
other 240 ish pages, the LoadViewState method is running properly.
Interesting though, one time during the debugger it did LoadViewState,
but it seemed to only be a fluke because it didn't work the next time in
debug mode. ( no code changes )
What are some of the reasons that would cause the LoadViewState method
to not fire? I have checked and the postback page request is being
correctly identified as a postback. EnableViewState is also set to true.
TIA,
bill
1.1 .Net framework