ANAT2403
asked on
hide the lines of VIEWSTATE in view source of a page
Hi,
In asp.net 2.0 with C# I want then when I will look at the running page in the browser and make view source I will not see the VIEWSTATE word appears at all.
I see this situation in other sites. How this is done?
Anat
In asp.net 2.0 with C# I want then when I will look at the running page in the browser and make view source I will not see the VIEWSTATE word appears at all.
I see this situation in other sites. How this is done?
Anat
Just don't use VIEWSTATE unless you have to.
ASKER
Hi,
I did not use it . It is created automatically and I don't know what cause it? This is what I want to understand.
Thankyou
anat
I did not use it . It is created automatically and I don't know what cause it? This is what I want to understand.
Thankyou
anat
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
I understand it now much better. Just one more question:
I don't use a gridview but I do use an asp: repeater control. and I have event in the databound of this.
How the repeater work with the viewstae if at all?
And also how the menu control and masterpage work or use the view state.
Thankyou
Anat
I understand it now much better. Just one more question:
I don't use a gridview but I do use an asp: repeater control. and I have event in the databound of this.
How the repeater work with the viewstae if at all?
And also how the menu control and masterpage work or use the view state.
Thankyou
Anat
Viewstate is most important when you have input controls and do things that changes data and do things that require the page to "remember" values between postbacks.
If your repeater doesn't act as an "edit" form, then turning viewstate off should be ok.
It's not something I'd recommend be done globally (in web.config).
Easiest thing to do is disable it and test to see if you notice differences.
If your repeater doesn't act as an "edit" form, then turning viewstate off should be ok.
It's not something I'd recommend be done globally (in web.config).
Easiest thing to do is disable it and test to see if you notice differences.
Correct. If in doubt, simply enable/disable viewstate to notice the difference.
ASKER
Hi everybody,
I made a test and discovered strange things:
I took my web site and and made 4 tests:
1. I put enableviewstate=false in one of the content pages.
2. I did 1 + enableviewstate=false in master page
3. I put <pages enableViewState="false" /> in web.config with and without 1+2
4. I put in each server control in a content page enableviewstate=false
results:
in all tests when I looked at view source I see that
input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTI0NzcwMjk 1......
was in a smaller size but still it remains big and did not disappear.
only test 1 did the job. all the other tests did not have any affect.
As I render my page in each loading I don't need the viewstate and I want to disabe it.
How is it done?
I made a test and discovered strange things:
I took my web site and and made 4 tests:
1. I put enableviewstate=false in one of the content pages.
2. I did 1 + enableviewstate=false in master page
3. I put <pages enableViewState="false" /> in web.config with and without 1+2
4. I put in each server control in a content page enableviewstate=false
results:
in all tests when I looked at view source I see that
input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTI0NzcwMjk
was in a smaller size but still it remains big and did not disappear.
only test 1 did the job. all the other tests did not have any affect.
As I render my page in each loading I don't need the viewstate and I want to disabe it.
How is it done?