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

Asp.Net

In global.asax: protected void Application_BeginRequest(Ob... sender, EventArgs e) { HttpRuntimeSection runTime = (HttpRuntimeSection)WebConf... //Approx 100 Kb(for page content) size has been deducted because the maxRequestLength proprty is the page size, not only the file upload size int maxRequestLength = (runTime.MaxRequestLength - 100) * 1024; //This code is used to check the request length of the page and if the request length is greater than...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

<script type="text/javascript" language="javascript"> Sys.WebForms.PageRequestMan... function refresh() { //Your code here; } </script> Source
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Type myType = typeof(MyClass); string methodName = "methodNameAsString"; MethodInfo myTypeGetMethod = myType.GetMethod(methodName); MyClass obj = new MyClass(); object[] parms = { 123, "string test"}; myTypeGetMethod.Invoke(obj, args);
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

protected override void OnPreInit(EventArgs e) { Page.MasterPageFile = "~/LinkToMasterPage"; base.OnInit(e); } Enjoy :)
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Response.Clear();Response.C... = "application/pdf";Response.... "attachment;filename=\"File... SourceEnjoy :)...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Hello, If you are reading this you probably have already realized that it is not possible to hide a column that was auto-generated using myGridView.Columns[index].V... To achieve this you must: 1 - set the OnRowCreated to execute a function, something like OnRowCreated="gridRowCreated" 2 - Create your function as such: protected void gridRowCreated(object sender, GridViewRowEventArgs e) { e.Row.Cells[yourIndexHere].... = false; } Hope this helps ;)...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

A few days ago I got an error report to fix. Some web application that I now maintain was inserting duplicate records. After a quick look it became obvious that the users where double clicking the submit button and that made the page post twice and so a duplicate record would appear. A quick fix dor this problem using javascript: <script language="javascript" type="text/javascript"> var haveSubmitted=false; function FirstSubmitOnly() { if (haveSubmitted) return false; haveSubmitted = true;...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

I think at some point everybody had this problem... A big form with some control that forces a postback. If you have scrolled down, the page scroll will be placed at the top. To force the aspx to keep the scroll, just place the following instrucion on the <pages> tag of your web config. <pages maintainScrollPositionOnPos... Enjoy :)
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Simple how to refresh page every 60 seconds <meta http-equiv="refresh" content="60">...
  • 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

Full Asp.Net Archive