473,378 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Completely disable viewstate

Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

Jan 3 '07 #1
6 1879
<sr*****@mailcity.comwrote in message
news:11********************@i12g2000cwa.googlegrou ps.com...
And, as per my understanding, it just cant be eliminated.
I believe you are correct...
Jan 3 '07 #2
as you don't care about postback just add to your page:
// override standard viewstate handler with do nothing
protected override void SavePageStateToPersistenceMedium(Object state)
{
}
-- bruce (sqlwork.com)

sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.
Jan 3 '07 #3
On 3 Jan 2007 07:48:00 -0800, sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.
You'll probably run into problems trying to get a XML compliant document
from a HTML page unless you go out of your way to make the page compliant.

If you really need to eliminate the viewstate you could use a regular
expression to find and remove it.
--
Bits.Bytes
http://bytes.thinkersroom.com
Jan 3 '07 #4
Thanks for the reply. I would appreciate any pointers in specific the
use of regular expressions to remove it from the page.

P.S: Overriding 'SavePageStateToPersistenceMedium' clears the viewstate
completely but the hidden control is still rendered on the page.

Thanks again,
Sam.

Rad [Visual C# MVP] wrote:
On 3 Jan 2007 07:48:00 -0800, sr*****@mailcity.com wrote:
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

You'll probably run into problems trying to get a XML compliant document
from a HTML page unless you go out of your way to make the page compliant.

If you really need to eliminate the viewstate you could use a regular
expression to find and remove it.
--
Bits.Bytes
http://bytes.thinkersroom.com
Jan 3 '07 #5
"bruce barker" <no****@nospam.comwrote in message
news:Ou**************@TK2MSFTNGP03.phx.gbl...
as you don't care about postback just add to your page:

// override standard viewstate handler with do nothing
protected override void SavePageStateToPersistenceMedium(Object state)
{
}
Yes, but that still leaves the hidden controls which the OP wants removed,
for some reason...
Jan 3 '07 #6
do this using a response filter + regex

Gerry
<sr*****@mailcity.comwrote in message
news:11********************@i12g2000cwa.googlegrou ps.com...
Hello,
I have a aspx page in which I would like to eliminate all of
the hidden variables as this page would be imported to an email client
and the hidden controls are usually rendered in the mail client. The
asp.net form does have the form input hidden control inspite the
viewstate is disabled at the page level. Isnt there a way to eliminate
it? And, as per my understanding, it just cant be eliminated. Now, I
was trying to parse the page treating it as a XML doc and remove the
hidden control. The problem there would be - there is no guarantee that
the XML document is well formed as the page contains formatted text and
might miss some of the closing tags. Is there a better way to get rid
of the input hidden form level viewstate ( ID = "__VIEWSTATE") ?

Thanks,
Sam.

Jan 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Homa | last post by:
Hi, I have a datalist with linkbuttons embedded within. In order for the onClick event to fire, I need to have EnableViewState = true. But since there are quite a lot of data, simply enable...
1
by: Jeff S | last post by:
I'm trying to optimize performance of a few pages. Toward this result, I have done the following: 1. set EnableViewState="false" and EnableSessionState="false" in the @ Page directive. 2. set...
1
by: Rhodri | last post by:
Hi all I have a datagrid which can display upto 20,000 records and the viewstate gets very big. I have tried turning of viewtate using EnableViewState = false both on the parent page and on the...
3
by: Stan | last post by:
Dispite the fact that ViewState="false" at the page level, and all controls have viewstate disabled, ViewState is still on the page (<input type="hidden" name="__VIEWSTATE" value="..." /> Why...
2
by: Fluxray | last post by:
--Background: I have a webform including a datagrid. The datagrid is using template. Its ItemTemplate is used to display a look-up-table with labels. its EditItemTemplate is used to edit a row in...
2
by: Jonathan Folland | last post by:
I have been working on this most of the day and cannot find a solution to my problem. I have an application where I may not actually have a page. for example a user may make a request for...
4
by: Umut Tezduyar | last post by:
I want to get rid of the hidden field _VIEWSTATE. I tried these: I tried to disable ViewState property. I tried to override Page's RegisterHiddenField method. I tried to override Page's...
7
by: George Ter-Saakov | last post by:
on my page I have <%@ Page Language="C#" EnableViewState="false"%> But in HTML i still see __VIEWSTATE hidden variable. <form name="form1" method="post" action="......" id="form1"> <div>...
4
by: =?Utf-8?B?TUNN?= | last post by:
I am trying to disable ViewState at the application level. I have the following line in my web.config: <pages enableViewState="false"></pages> But it is not working. What can I do?
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.