xeroxero,
The first two are simple:
Page.MaintainScrollPositionOnPostBack = true;
Page.Title = "hello";
The page ViewStateEncryptionMode property complains with an exception if you
try to set it manually: "The 'ViewStateEncryptionMode' property can only be
set in the page directive or in the <pagesconfiguration section"
Probably for security reasons, if a page has been configured to require
encrypted viewstate... well... allowing the code to change this would be
incorrect (given that the declaritive security requirements should override
requirements expressed in code). So... you're out of luck there.
However there is the "RegisterRequiresViewStateEncryption()"... which will
force the veiwstate to be encrypted. This must be done in prerender or
before.
As to LinePramas... I think you're out of luck. LinePragmas is more of an
instruction to the ASP.NET compiler (the one that produces pure C#/VB.NET
code that is then compiled by .net). By the time your code is running...
it's already way too late (code has been generated and compiled).
Regards,
Rob MacFadyen
"xeroxero" <xe******@newsgroups.nospam wrote in message
news:kr********************************@4ax.com...
>
I would like to set the following Page directives in my C# code-behind
for ASP.NET 2.0 Web Application Project and also in a ASP.NET 2.0 Web
Site. What event should I hook and what should the code look like?
MaintainScrollPositionOnPostback
ViewStateEncryptionMode
LinePragmas
Title
Thanks.