Fórmulas e Cenas

Object Reference Not Set to an Instance of an Object

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



Image Galleries



If you are unable to access all jnlp files on your site, chances are that the myme type for jnlp files is not defined in IIS.On your site you need to add a new Mime Type using:Extension: .jnlpMime Type: application/x-java-jnlp-fil... this helps ......

When you are inserting into a table using entity framework, on rare occasions you might get the following error: {System.Data.OptimisticConc... Store update, insert, or delete statement affected an unexpected number of rows (0) This happened to me because of an "instead of INSERT" trigger that was active on the page. It turns out that EF does not go well with triggers, because it fails to get the inserted ID. For me, the solution was to change the trigger so that the last executed code ......

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 ......

<script type="text/javascript" language="javascript">


        function refresh() { //Your code here; }




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);


        protected override void OnPreInit(EventArgs e)
            Page.MasterPageFile = "~/LinkToMasterPage";


Enjoy :)

Response.Clear();Response.C... = "application/pdf";Response.... "attachment;filename=\"File... SourceEnjoy :) ......

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 ;) ......

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; ......

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 maintainScrollPositionOnPostBack="true">

Enjoy :)

Full Asp.Net Archive