Friday, 8 June 2012

The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file

Add <add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> to the system.web/httpHandlers section of the web.config file.



If you are facing such error this may help you.just change your web config with this.
<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
    <configSections>
        <sectionGroup name="system.web.extensions"

type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
            <sectionGroup name="scripting"

type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                <section name="scriptResourceHandler"

type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"

allowDefinition="MachineToApplication"/>
                <sectionGroup name="webServices"

type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
                    <section name="jsonSerialization"

type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"

allowDefinition="Everywhere"/>
                    <section name="profileService"

type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"

allowDefinition="MachineToApplication"/>
                    <section name="authenticationService"

type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"

allowDefinition="MachineToApplication"/>
                    <section name="roleService"

type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions,

Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"

allowDefinition="MachineToApplication"/>
                </sectionGroup>
            </sectionGroup>
        </sectionGroup>
    </configSections>
    <system.net>

    </system.net>
  <appSettings/>
   <connectionStrings/>
    <system.web>
        <!--
            Set compilation debug="true" to insert debugging
            symbols into the compiled page. Because this
            affects performance, set this value to true only
            during development.
        -->
    <machineKey

validationKey='4C8B22744D71B73CE6B16262A97CF3862E584829229EDE45C9DF207DDF5F3507782A3F2F650608502

8628868F6AFFC25D16BE4AD8BB677637B11C892F95FE819'  

decryptionKey='53EA49CFEC5C5A1E4720DE83E1CC75337674757144EB1DCB'   validation='SHA1'/>
        <compilation debug="true">
            <assemblies>
                <add assembly="System.Core, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Xml.Linq, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Web.Extensions.Design, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add assembly="System.Windows.Forms, Version=2.0.0.0,

Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                <add assembly="System.Data.Linq, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
                <add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0,

Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0,

Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                <add assembly="System.Net, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
            <buildProviders>
                <add extension=".rdlc"

type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=9.0.0.0,

Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            </buildProviders>
        </compilation>
        <!--
            The <authentication> section enables configuration
            of the security authentication mode used by
            ASP.NET to identify an incoming user.
        -->
        <authentication mode="None"/>
        <customErrors mode="Off">
        </customErrors>
        <!--
            The <customErrors> section enables configuration
            of what to do if/when an unhandled error occurs
            during the execution of a request. Specifically,
            it enables developers to configure html error pages
            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
            <error statusCode="403" redirect="NoAccess.htm" />
            <error statusCode="404" redirect="FileNotFound.htm" />
        </customErrors>
        -->
        <pages>
            <namespaces>
                <clear/>
           
                <add namespace="System"/>
                <add namespace="System.Collections"/>
                <add namespace="System.Collections.Generic"/>
                <add namespace="System.Collections.Specialized"/>
                <add namespace="System.Configuration"/>
                <add namespace="System.Text"/>
                <add namespace="System.Text.RegularExpressions"/>
                <add namespace="System.Linq"/>
                <add namespace="System.Xml.Linq"/>
                <add namespace="System.Web"/>
                <add namespace="System.Web.Caching"/>
                <add namespace="System.Web.SessionState"/>
                <add namespace="System.Web.Security"/>
                <add namespace="System.Web.Profile"/>
                <add namespace="System.Web.UI"/>
                <add namespace="System.Web.UI.WebControls"/>
                <add namespace="System.Web.UI.WebControls.WebParts"/>
                <add namespace="System.Web.UI.HtmlControls"/>
            </namespaces>
            <controls>
                <add tagPrefix="asp" namespace="System.Web.UI"

assembly="System.Web.Extensions, &#xA;            Version=3.5.0.0, Culture=neutral,

PublicKeyToken=31BF3856AD364E35"/>
                <add tagPrefix="asp" namespace="System.Web.UI.WebControls"

assembly="System.Web.Extensions, &#xA;                  Version=3.5.0.0, Culture=neutral,

PublicKeyToken=31BF3856AD364E35"/>
                <add tagPrefix="AjaxToolkit" namespace="AjaxControlToolkit"

assembly="AjaxControlToolkit, Version=3.5.40412.0, &#xA;         Culture=neutral,

PublicKeyToken=28F01B0E84B6D53E"/>
            </controls>
        </pages>
        <httpHandlers>
            <remove path="*.asmx" verb="*"/>
            <add path="*.asmx" verb="*"

type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
            <add path="*_AppService.axd" verb="*"

type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
            <add path="ScriptResource.axd" verb="GET,HEAD"

type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
            <add path="Reserved.ReportViewerWebControl.axd" verb="*"

type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms,

Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
        </httpHandlers>
        <httpModules>
            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule,

System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </httpModules>
    </system.web>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs"

type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"

type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="OptionInfer" value="true"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules>
            <remove name="ScriptModule"/>
            <add name="ScriptModule" preCondition="managedHandler"

type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral,

PublicKeyToken=31BF3856AD364E35"/>
        </modules>
        <handlers>
            <remove name="WebServiceHandlerFactory-Integrated"/>
            <remove name="ScriptHandlerFactory"/>
            <remove name="ScriptHandlerFactoryAppServices"/>
            <remove name="ScriptResource"/>
            <add name="ScriptHandlerFactory" verb="*" path="*.asmx"

preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory,

System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptHandlerFactoryAppServices" verb="*"

path="*_AppService.axd" preCondition="integratedMode"

type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0,

Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd"

preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler,

System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        </handlers>
    </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions"

publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0"

newVersion="3.5.0.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Extensions.Design"

publicKeyToken="31bf3856ad364e35"/>
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0"

newVersion="3.5.0.0"/>
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <system.serviceModel>
        <behaviors>
            <serviceBehaviors>
                <behavior name="ServiceBehavior">
                    <serviceMetadata httpGetEnabled="true"/>
                    <serviceDebug includeExceptionDetailInFaults="false"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service behaviorConfiguration="ServiceBehavior" name="Service">
                <endpoint address="" binding="wsHttpBinding"

contract="IService">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding"

contract="IMetadataExchange"/>
            </service>
        </services>
    </system.serviceModel>
</configuration>

Print Only Grid View in ASP.net

ASP.net How to Print Only GridView < div id ="gridviewDiv" >   < asp:GridView ID ="gridViewToPri...