Fórmulas e Cenas

Object Reference Not Set to an Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  45 Posts | 0 Stories | 13 Comments | 0 Trackbacks



Post Categories


April 2009 Entries

Today I will grumble about "best practices". It seams to me that a paranoia for "best practices" has overcome a lot of developers, some may even refusing to start a new task if they are not sure that the way it's going to be implemented meets a "best practice". What Exactly is a "best practice" anyway? A quick search reveals the following: Processes and activities that have been shown in practice to be the most effective. Standard, published operating methods found to produce the best performance ......

Just a simple snippet to show how an aspx can be exported to Excel Response.ClearContent(); Response.Buffer = true; Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("content... "attachment; filename=" + "teste" + ".xls;charset=iso-8859-1"); StreamWriter sw = new StreamWriter(Response.Outpu... System.Text.Encoding.GetEnc... HtmlTextWriter htmlTextWriter = new HtmlTextWriter(sw); this.RenderControl(htmlText... Response.End(); ......

Today I will post some sample code to get the html thar is generated from an aspx. It's quite usefull to create emails, pdfs and so on.

Enjoy :)

StringWriter str = new StringWriter();

HtmlTextWriter htmlSTRINGWriter = new HtmlTextWriter(str);

String myHtml = str.ToString();