Export gridview data to Excel document in asp.net C#

Follow the  steps involved :

Step 1:

Create a aspx page with a grid view control.


aspx code

 Step 2:
Add the code for the button click in ViewExcelReport.aspx.cs


Now you are done, you can export the grid view in to Excel format.

if you’re getting any error message like

RegisterForEventValidation can only be called during Render();

To solve, add the overriding function VerifyRenderingInServerForm event in code. 

Thanks for reading this article!! please leave your comments and suggestion about this article.



Error: HTTP Error 500.22 – Internal Server Error

This error indicates that your application is not coded to run in Integrated Pipeline Mode.

To resolve this issue you must either:

  • Update your code to run in Integrated Pipeline Mode.
<validation validateIntegratedModeConfiguration="false" />
  • Open iis and select the application pool for your Site and change managed pipeline mode in to integrated to Classic.

Now its Cleared.

HTTP Error 404.2 – Not Found

II7 error:
Error Summary
HTTP Error 404.2 – Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server.

Follow the Below Steps:
1.       Double click the Server Name “xxxx”, then double click “ISAPI and CGI Restrictions
2.  Then select the version and select Allow from the right panel.

Now its Cleared.

How to add a New Eclipse Project to an SVN Repository

Adding a Project to SVN from Eclipse

Follow the below steps: 
1) Right-click the project and select Team -> Share Project.
2) Select SVN as the repository type.

3) Select the repository this project should be stored in.

4) Select the repository directory where the project should be stored, and click Finish.

5) Now the /trunk/SimpleProject directory is created in the repository, and the project is associated with this repository location in Eclipse. You can now commit (upload) your changes by right-clicking and selecting Team -> Commit.

When you’re done, the project will be linked with the repository

ASP.NET v2.0 to be set to ‘Allow’ in the list of IIS Web Server Extensions.

When trying to install any web services you will receive the following error.

“ASP.Net must be set to be allowed in Internet Information Services (IIS)  web service extension”
In any case IIS in installed after the .Net Framework installation, this type of error occurs.

To Fix this error follow the below steps :

1. Go to command prompt and then change the directory to        


2. Then run  the command “aspnet_regiis.exe -i” as shown below.

3. After this command completes successfully open IIS Manager and go to web service extensions and mark the “ASP .NET v2.0.50727″ as Alloweb if it isnt already.

Remove or Uninstall Dynamics GP Web Services manually

Steps to remove Microsoft Dynamics GP Web Services manually:

I found a couple of blogs that were parts of the solution… thanks to 

1. Remove “Adam Instance DynamicsSecurityService” in Add\Remove Programs.

2. In IIS Manager, delete “Dynamics Security Admin Service” Web site.

3. In IIS Manager, delete “DynamicsGPWebServices” and DynamicsSecurityService” virtual directories from the Web site that the Web Services for Microsoft Dynamics GP was installed on.

4. In IIS Manager, delete the “DynamicsSecurityAdminServiceAppPool”, “DynamicsSecurityServiceAppPool”  and “GPWebServicesAppPool” application pools.

5. Delete the “Microsoft Dynamics” folder from C:\Program Files\Common Files\Microsoft Shared.

6. Delete “GPWebServices” folder from C:\Program Files\Microsoft Dynamics (This is the default location for Web site files.).

7. Delete “Dynamics GP Web Service Exception Management Console” and “Dynamics Security Console” shortcuts from Administrative Tools program folder.

8. Delete related Registry Keys for Web Services for Microsoft Dynamics GP 9/10.0. 
  (delete the registry keys using link : http://support.microsoft.com/kb/314481)

9. Remove the DynamicsGPWebServices key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\

10. After these steps , Go to run->regedit and hit enter.

11. Then find for the “Web Services” or “WebServices” words and delete the registry keys.(Don’t delete that wasn’t related to GP web services).

12. FINALLY web services are no longer being shown in the Add or Remove programs.

13.  Then, now install a new instance of GP 10 web services.(recommended to use a new web site and a new port number if possible). 

14.Run Installation file with following command it will help to create log if it show any installation error.

msiexec.exe/i “C:\Path\DynamicsGPWebServices.msi”/l*v C:\WSVerbose.log”
*****replace Path with the actual pathname to the DynamicsGPWebServices.msi file, in which you’re using to start the install*****

For more Infos : Sandip Jadhav  Robin Seaberg

Microsoft Dynamics GP Web Services installation Error

When you try to install Web Services for Microsoft Dynamics GP, an error message such as “Fatal Error During Installation”.

To resolve some of these installation errors, follow these steps:

1.  Verify that the ISO currency codes in Microsoft Dynamics GP are unique and are exactly three characters long. To set up the ISO Code , follow the steps in the below link:


2. Verify that a functional currency is specified for each company. To do this, follow  in the below link:


3. Verify that all the companies that are listed in the DYNAMICS database still exist.Then make sure that all the companies are upgraded to the current version of Microsoft Dynamics GP.

4.  If you use Microsoft Dynamics GP 10.0 or Microsoft Dynamics GP 9.0, make sure that the Internet Information Services (IIS) site on which Web Services is being installed has no other applications installed, such as SQL Reporting Services or Microsoft Dynamics CRM. In addition, the site cannot be extended through SharePoint. 

5. If the server on which Web Services is being installed is different than the Microsoft SQL Server-based server on which the Microsoft Dynamics GP databases reside, enable Network DTC Access on both servers.

817064 How to enable network DTC access in Windows Server 2003 

cc753510 How to enable network DTC access in Windows Server 2003 

6. If you tried to install Web Services but failed after you followed steps 1 to 5, use one of the following methods.

Method 1 : Uninstall Microsoft Dynamics GP Web Services Completely and try to reinstall it.
Method 2 : Remove Windows Security updates

       When you install some of the security updates will cause the Logon Agent for certain versions of Websense Web Filter or Websense Web Security may no longer work correctly to identify users.

For more Infos : MS Dynamics GP