Hello,
In some pages of Telerik site we can see large viewstate.
you can simply send viewstate to end of pages for faster download & better indexing in search engines.
My suggestion based on 2 posts from scott
1. Google AdSense and ASP.NET View State
2. Using a Base Class to Fiddle with a Page's Rendered Output
you can use this base class that the ASP.NET pages in your application extend for optimizing output of pages in your site.
using System.IO;
using System.Web.UI;
/// <summary>
/// Summary description for OptimizedBasePage
/// </summary>
public class OptimizedBasePage : Page
{
protected override void Render(HtmlTextWriter writer)
{
StringWriter stringWriter = new StringWriter();
HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
base.Render(htmlWriter);
string html = stringWriter.ToString();
int StartPoint;
int SLength;
//remove some invisible characters to compress output
html = html.Replace("\t", "");// tabs
html = html.Replace(" ", " ");// double spaces
html = html.Replace(" />", "/>");// space before end of tags
StartPoint = html.IndexOf("<input type=\"hidden\" name=\"__VIEWSTATE\"");
if (StartPoint >= 0)
// does __VIEWSTATE exist?
{
SLength = html.IndexOf("/>", StartPoint) + 2 - StartPoint;
string ViewStateInput = html.Substring(StartPoint, SLength);
html = html.Remove(StartPoint, SLength);
int FormEndStart = html.IndexOf("</form>");
html = html.Insert(FormEndStart, ViewStateInput);
}
writer.Write(html);
}
}
Best regards
Mostafa
I am looking for a an example of an application with the following capabilities:
MUlti-page control with a tab strip with three tabs - Browse/Edit1/Edit2
Browse Tab - grid with records from a table
Edit1 Tab - fields for one record
Edit2 tab - more fields from the same record
Operation - user selects record on "Browse" page and then goes to "Edit1" page or "Edit2" page to view/change the data (ideally, AJAX would be used to retrieve the data for the selected record)
I would like a working sample that uses NorthWind or AdventureWorks customer table.
I am willing to pay for the sample.
Thanks