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() {
setTimeout(“DeleteHistory()”, 1000);
window.onunload = function () { DeleteHistory(); };

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
Reference 12
Reference 13
Reference 14
Reference 15
Reference 16
Reference 17
Reference 18
Reference 19

Posted in ASP.NET 4, ASP.NET 4 And Javascript, JavaScript | Leave a comment

Microsoft Product End of Suport Date

The following microsoft product end of support date and end of sales date.
Windows Lifecycle Fact Sheet Window OS Products

Visual Studio Lifecycle Fact Sheet
Visual Studio Product

SQL Server Lifecycle Fact Sheet
SQL Server Products

Posted in End of Support Date, SQL Server, Visual Studio, Windows OS | Leave a comment

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

Aside | Posted on by | Leave a comment

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.


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.

Posted in Reporting Service Client (RDLC), Reporting Services 2008, Visual Studio 2010 | Leave a comment

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

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)

Posted in Reporting Services 2008, SQL Server 2008, Visual Studio 2010 | Leave a comment

How to create and use web site template in visual studio 2010?

this blog shows you on how to create and use web site template in visual studio 2010.  Before creating a template, you need to create a web site or project that you like to create a template.

Step 1: Click on File then find and click on Export Template.

Step 2: On Choose Template Type, choose project or item template, then choose which project you like to create a template, and then choose either C #or VB.NET.

Step 3: You will see your entire project in this solution. You need to pick one. Then click on next.

Step 4: You can provide template name, template description, icon image, preview image. Then click on finish button.

Step 5: Go to you’re my computer, Here is a sample path, C:\Users\<user name>\Documents\Visual Studio 2010\My Exported Templates. You can see your template in zip format.

Step 6: Copy and paste the zip file from C:\Users\<user name>\Documents\Visual Studio 2010\My Exported Templates\ to C:\Users\<user name>\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#\.

Step 7: Click on File, then click on new web site, find and choose your newly created template. Type your project name and then click OK.

In case that the export template is missing, try to reset settings. Find and click on Tools, then find and click Import and Export Settings.



Note: I have not yet included any images in this post.

Posted in .NET Framework 4, C# 4.0 AND ASP.NET 4.0, Project Template, Web site Template | Leave a comment

How to create reports (rdlc) and load inside report viewer?

This blog will show you how to create report (rdlc not rdl) and display inside report viewer not thru browser. This post also shows you on how to use entity framework as a data source.

Step 1 – Find and Choose Report Wizard. You need to type your chosen report name.

Step 2 – Type in your chosen dataset name at dataset properties. Then click on Add button.

Step 3 – Either choose existing data source or create new data source. If you choose existing data source and select item from the drop down list. If you choose to create new connection, you need to click the button beside the drop down list.

Step 4 – Use the drop down list to select available dataset.

Step 5 – At Arrange fields, drop and drop items from Available fields to Values section.

Step 6 – Once you finish drag and drop, click next.

Step 7 – Click next.

Step 8 – Choose a style from the list. Click next.

Step 9 – Report Data will be display all fields selected.

Step 10 – The report will be displayed.

Step 11 – Right click on report viewer properties and set local report’s report path and data sources.

This is sample code, wherein you set data source and parameters of your report.

string Param1 = this.ddl_Param1.SelectedValue== “0” ? string.Empty : this.ddl_Param1.SelectedValue;

string Param2 = this.ddl_Param2.SelectedValue == “0” ? string.Empty : this.ddl_Param2.SelectedValue;

string Param3 = this.ddl_Param3.SelectedValue == “0” ? string.Empty : this.ddl_Param3.SelectedValue;

string Param4 = this.ddl_PARAM4.SelectedValue == “0” ? string.Empty : this.ddl_PARAM4.SelectedValue;

#region “ReportDataSource”

if (_myClassLibrary == null)

_myClassLibrary = new MyClassLibrary();

var list = new List<Entity>();

list = _myClassLibrary.myMethod(Param1, Param2, Param3, Param4);


this.Reportviewer.LocalReport.DataSources.Add(new ReportDataSource(“DataSet1”, list));


var Param1Param = new ReportParameter(“Param1”, Param1);

var Param2Param = new ReportParameter(“Param2Id”, Param2);

var Param3Param = new ReportParameter(“Param3Code”, Param3);

var Param4Param = new ReportParameter(“Param4Id”, Param4);

this.Reportviewer.LocalReport.SetParameters(new[] {Param2Param});

this.Reportviewer.LocalReport.SetParameters(new[] {Param3Param});

this.Reportviewer.LocalReport.SetParameters(new[] {Param1Param});

this.Reportviewer.LocalReport.SetParameters(new[] {Param4Param});


Note: I have not put any images yet and will later edit this post if I do have time to edit this post again.

Posted in .NET Framework 4, C# 4.0 AND ASP.NET 4.0, Linq to Entity, RDLC, Report Viewer, Reporting Services 2008 | Leave a comment

Lenovo Useful URL Links

Useful links

Posted in Laptop, Lenovo, Lenovo Service Center, Lenovo Z460 | Leave a comment

Using ReportViewer in ASP.NET 4.0 and Entity Framework

To bind a data source to a reportviewer:

Add this line after <%@ Page … ,

<%@ Register Assembly=”Microsoft.ReportViewer.WebForms, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”
Namespace=”Microsoft.Reporting.WebForms” TagPrefix=”rsweb” %>

<rsweb:ReportViewer ID=”ReportName” BorderStyle=”Solid” BorderColor=”Gray”
BorderWidth=”1px” runat=”server” Font-Names=”Verdana” Font-Size=”8pt” InteractiveDeviceInfos=”(Collection)”
WaitMessageFont-Names=”Verdana” WaitMessageFont-Size=”14pt” Width=”100%” Height=”470px”>
<LocalReport ReportPath=”ReportPath.rdlc”>

At the code behind,

DataSource _datasource = new DataSource();
ReportDataSource itm = new ReportDataSource(“ReportDataSourceName”, _datasource.GetDataSourceList(this.HiddenField.Value));

To setup parameters of reportviewer:

var messageParam = new ReportParameter(“Message”, Value);

this.ReportName.LocalReport.SetParameters(new[] { messageParam });

Conclusion: This blog need to be edited further.

Posted in .NET Framework 4, C# 4.0 AND ASP.NET 4.0, Linq to Entity, Visual Studio 2010 | Leave a comment

CodeSmith: Software Development Tool

CodeSmith is a software development tool to help you get your job done faster. Technically speaking it is a template driven source code generator that automates the creation of common application source code for any language (C#, Java, VB, PHP, ASP.NET, SQL, etc.) or any text based output.

CodeSmith enables software developers to efficiently:

• Reduce repetitive coding
• Generate your code in less time with fewer bugs
• Produce consistent code that adheres to your standards
• Create your own custom templates for any language

CodeSmith Generator Features

• CodeSmith Studio – CodeSmith Studio makes building your own custom templates very easy. With Intellisense you can create or modify your templates with ease.

• Visual Studio Integration – With integration into the MSBuild pipeline and Visual Studio 2005/2008/2010, you can actively generate without ever leaving Visual Studio. Visual Studio integration also features the ability to create your own active snippets for common tasks like creating properties from metadata.

• Template Debugging – CodeSmith makes it easy to debug your templates by providing the CodeSmith template developer with the line number in the template where the problem occurred.

• Rich XML and MetaData Support – The XmlProperty directive allows you to easily use XML to drive your templates. If an XSD schema is provided, a strongly typed XML object model will automatically be generated and makes working with XML simple.

• Merge Capabilities – The merging capabilities in CodeSmith allow you to merge generated and hand written code within a single file.

• Master templates – Provide an efficient way to execute many templates known as sub-templates at one time. Master Templates are very useful when creating dynamic, structured and well controlled output.

• Active Community – Join in and collaborate with other CodeSmith users about questions, issues or ideas that you may have.

• Console Client – The console client allows you to easily automate your code generation process and can execute templates one at a time or in batches.

• Auto SQL Script Execution – Templates that generate SQL scripts can be auto-executed after generation allowing for easy deployment of generated SQL code.

• Fast Compiler & Template Caching – CodeSmith can compile and execute your custom templates very fast and efficiently.

Supported Template Frameworks

• LINQ to SQL (PLINQO) – Replace and enhance Microsoft’s LINQ to SQL with PLINQO. These open source CodeSmith templates open the LINQ to SQL black box, giving you the ability to control your source code while adding many new features and enhancements. It’s still LINQ to SQL, but better!

• CSLA – Generate CSLA in minutes with our CodeSmith CSLA templates. Rockford Lhotka’s CSLA .NET framework is an application development framework that reduces the cost of building and maintaining applications.

• NHibernate – NHibernate is a port of Hibernate Core for Java to the .NET Framework. It handles persisting plain .NET objects to and from an underlying relational database. Given an XML description of your entities and relationships, NHibernate automatically generates SQL for loading and storing the objects. Optionally, you can describe your mapping metadata with attributes in your source code.

• .netTiers – .netTiers is a set of open source code generation templates that simplify the tasks of creating customized Application Tiers for your Microsoft.Net applications in just a few minutes. .netTiers generated architecture is custom to your domain, uses familiar patterns, and follows the guidance of Microsoft’s recommended patterns and practices. In fact, the .netTiers base architecture is built upon the Microsoft Enterprise Library Application Blocks.

Posted in Code Generator, Software Development Tool | Leave a comment