Fórmulas e Cenas

Object Reference Not Set to Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 0 Stories | 6 Comments | 0 Trackbacks

News

Archives

Post Categories

Links

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...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

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();...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

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 :) Response.ClearContent(); StringWriter str = new StringWriter(); HtmlTextWriter htmlSTRINGWriter = new HtmlTextWriter(str); this.RenderControl(htmlSTRI... String myHtml = str.ToString();
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati