How to remove the ViewState from my MarkUp in ASP.Net?

Posted by Peermohamedmydeen under Regular Expressions on 10/4/2010 | Points: 10 | Views : 2187 | Status : [Member] | Replies : 6
Hi,

Nice Day,

How can I give the .aspx page with out viewstate in the markup?

In my C# Winforms application, Am copying an .aspx page into word? The .aspx page is coming from my WebService.

Due to viewstate value, my .doc is not opening. Any how I opened the .doc by removing the line and save in local machine.


But I need, the .aspx should rendered as html without the viewstate line in the markup by default.

Thanks in Advance.




Responses

Posted by: Vuyiswamb on: 10/4/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
then what you need is to disable the view state at a page level. do it at the top of your aspx page

EnableViewState="false"


Thank you for posting at Dotnetfunda
[Administrator]

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Peermohamedmydeen on: 10/4/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi Vuyiswamb,

I have already tried with

EnableViewState="false"


But still, its showing the viewstate hidden field in my mark up.

Note : I have not used any Server Controls or HTML Controls. I simply used <table>,<tr>,<td> and <div> in my .aspx page.



Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 10/4/2010 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
then disable the view state for every control you have there

Thank you for posting at Dotnetfunda
[Administrator]

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Peermohamedmydeen on: 10/4/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

I don't have any server controls in that .aspx page.

I made EnableViewState="false".

But still its showing. Any other suggestion?

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Premkumark on: 10/5/2010 [Member] Starter | Points: 25

Up
0
Down
Hi,

If you are rendering in table or div tag then use


<Table Id or Div ID>.EnableViewState= false;

try out this.....

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Peermohamedmydeen on: 10/5/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi PremKumar,

I have tried in all server controls like <div>,<Head>,<body> with EnableViewState="false".

I think we cannot get the MarkUp without ViewState hidden field for an .aspx page. It must come with some default ViewState values, for all .aspx pages.

Any how I have done this by removing the ViewState in my Front-End.

Thanks for the suggestion.

Peermohamedmydeen, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response