Geeks With Blogs
Fórmulas e Cenas Object Reference Not Set to an Instance of an Object Asp.Net
Can't access jnlp file on IIS
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 ......

Posted On Monday, May 19, 2014 11:30 AM

Entity Framework, Insert Fail
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 ......

Posted On Tuesday, January 22, 2013 10:35 AM

How to use an Aspx as a proxy for a PDF file
Response.Clear();Response.C... = "application/pdf";Response.... "attachment;filename=\"File... SourceEnjoy :) ......

Posted On Friday, February 5, 2010 12:25 PM

Hidding auto generated columns in GridView
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 ;) ......

Posted On Thursday, October 29, 2009 9:23 AM

Prevent Double Post
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; ......

Posted On Wednesday, August 19, 2009 12:26 PM

Keep Scroll on Postback
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 :)

Posted On Friday, June 5, 2009 11:30 AM

How to handle ""Maximum request length exceeded" exception
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 ......

Posted On Tuesday, September 20, 2011 6:36 AM

How to execute a javascript function every time an updatepanel executes an async postback

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

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(refresh);

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

</script>

 

Source

Posted On Tuesday, September 20, 2011 4:57 AM

How to: Invoke a method by name

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

 

Posted On Monday, May 31, 2010 8:41 AM

How to: Change Master Page at runtine

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

 

Enjoy :)

Posted On Wednesday, March 3, 2010 5:39 AM

Copyright © Sglima | Powered by: GeeksWithBlogs.net | Join free