- This topic has 0 replies, 2 voices, and was last updated 11 years, 4 months ago by
Nitesh.
Viewing 3 posts - 1 through 3 (of 3 total)
- AuthorPosts
- February 2, 2012 at 6:32 am #3430
Nitesh
MemberHello
I was working on a ASP.NET seo friendly website and therefore to move the ASP.NET page ViewState to the bottom of the page in order to get Google to pay more attention to my page and less to the wad of ViewState.
Help meFebruary 2, 2012 at 7:21 am #3432Pavan
MemberHello Nitesh,
When we go through page life cycle Render events responsible for display the controls on browser. This event convert server side control into html control.This is event is also part of saving view state on page.
if you want to deep knowledge of page life cycle then go through the author code url:http://www.authorcode.com/asp-net-page-life-cycle/
Below is the code of render event that move the ViewState to the bottom of page.
protected override void Render(System.Web.UI.HtmlTextWriter writer) { System.IO.StringWriter stringWriter = new System.IO.StringWriter(); HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter); base.Render(htmlWriter); string html = stringWriter.ToString(); int StartPoint = html.IndexOf(" < input type=\"hidden\" name=\"__VIEWSTATE\""); if (StartPoint >= 0) { int EndPoint = html.IndexOf("/>", StartPoint) + 2; string viewstateInput = html.Substring(StartPoint, EndPoint - StartPoint); html = html.Remove(StartPoint, EndPoint - StartPoint); int FormEndStart = html.IndexOf("") - 1; if (FormEndStart >= 0) { html = html.Insert(FormEndStart, viewstateInput); } } writer.Write(html); }
February 2, 2012 at 8:16 am #3433Nitesh
MemberThanx Alot pawan for the help
- AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.