Wednesday, October 10, 2012

How to manipulate back button in ASP.NET 4?

After searching a lot of references. I have came to a conclusion that you can only prevent user from accessing the previous page is thru javascript window history. You can not manipulate the forward button but only the back button. There are many ways to do it, if you really want to manipulate both button is to clear cache like this,
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Expires = 0;
Response.CacheControl = “no-cache”;

To manipulate the previous page (back button) is thru this way,

<script type="text/javascript" language="javascript">
function DeleteHistory() {
window.history.go('Default.aspx');
}
setTimeout("DeleteHistory()", 1000);
window.onunload = function () { DeleteHistory(); };
</script>

Here are references that I have used:
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Reference 10
Reference 11

Javascript back button asp.net
Reference 12
Reference 13
Reference 14
Reference 15
Reference 16
Reference 17
Reference 18
Reference 19

Tuesday, May 8, 2012

Optimize performance of your Entity Framework 4 on Client Side


If you want to improve the perforamance of your entity framework in client side, you can use Cache from
System.Web.Caching.Cache object. If you like to reset values,
Cache.Remove("Name of your Cache");
If you wish to store the value to a cache,
if (Cache.Get("Name of your Cache") == null)
    Cache.Insert("Name of your Cache", object);
Where your object can be dataset or datatable or list.
You can determine which part of your code that needs to refactor your existing code using Entity Framework Profiler.
Entity Framework Profiler
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Reference 10
Reference 11
Reference 12
Reference 13
Reference 14

Thursday, April 12, 2012

Troubleshooting your rdlc inside Visual Studio 2010.

In order to troubleshoot your rdlc inside Visual Studio 2010.
Problem: how to make table invisible when there is no row.

Solution:  Set the expression for the row,
=IIF(Fields!BILLER.Value is nothing, true, false)
Step 1: Right click the tablix, choose and click row visibility.
Step 2: Choose and click the button beside “Show or hide based on an expression”.
Step 3: Enter the expression, =IIF(Fields!BILLER.Value is nothing, true, false).

Problem 2: How to display the image inside the report viewer.

Solution: You need to set the UI culture and culture for an individual page, set the Culture and UICulture attributes of the @ Page directive, as shown in the following example:
<%@ Page UICulture="es" Culture="es-MX" %>
To insert image on the report itself.
Step 1: Right click and choose insert then choose and click on image.
Step 2: Click on import button.
Step 3: Choose and click on the image.

Problem 3: How to create a variable that will make computations, like quantity multiply price equals sales.

Solution:
Step 1: Find and Click on Report Properties.
Step 2: Find and click onVariables.
Step 3: Click Add Button.
Step 4: Enter your chosen name. Then click on “fx” button.
Step 5: Enter your expression after the equal sign.

References used:
Reference 1
Reference 2
References 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Note: I will include the images in this post next time.

Saturday, April 7, 2012

Useful links for SQL Server 2008 and Visual Studio 2010 Service Pack

SQL Server 2008 SP1

SQL Server 2008 SP2

SQL Server 2008 SP3

SQL Server 2008 R2 SP1

SQL Server 2008 R2 SP2

Microsoft SQL Server 2008 SP2 Reporting Services Report Builder

Microsoft Visual Studio 2010 Service Pack 1

Security Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2645410)

Update for Microsoft Visual Studio 2010 Service Pack 1 Report Viewer (KB2549864)

Visual Studio 2010 Performance Tools with Service Pack 1

Visual Studio 2010 Remote Debugger with Service Pack 1

Update for Microsoft Visual Studio 2010 Service Pack 1 Web Platform Tools

Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2635973)

Microsoft Visual Studio 2010 Service Pack 1 MFC Security Update

Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2529927)

Update for Microsoft Visual Studio 2010 Service Pack 1 TFS Build Explorer (KB2522890)

Microsoft Report Viewer Redistributable 2005 Service Pack 1

Microsoft Report Viewer 2008 SP1 Redistributable

Microsoft SQL Server 2008 R2

Microsoft Report Viewer 2010 Redistributable Package

.NET Framework 4

Microsoft .NET Framework 4 KB2468871

Update 4.0.2 for Microsoft .NET Framework 4 – Design-time Update for Visual Studio 2010 SP1 (KB2544525)

Multi-Targeting Pack for Microsoft .NET Framework 4.0.2 (KB2544526)

Microsoft .NET Framework 4 Platform Update 1 – Design-time Update for Visual Studio 2010 SP1 (KB2495593)

Update 4.0.2 for Microsoft .NET Framework 4 – Runtime Update (KB2544514)

Microsoft .NET Framework 4 Platform Update 1 - Runtime Update (KB2478063)