Thursday, 29 January 2015

Solution for the Asp.net error "The type or namespace name 'ToolkitScriptManager' does not exist in the namespace"

INTRODUCTION:

In this article I am going to give you the solution to get rid of this error 
"The type or namespace name 'ToolkitScriptManager' does not exist in the namespace 'System.Web.UI.WebControls' (are you missing an assembly reference?)". 

  This being a quite annoying error, many usually come across while running a solution of a ASP.NET project which has got few a AJAX coding in it 

  Now let me share you the solution which had worked for me and hope the same for you too :)

SOLUTIONS:

POSSIBILITY 1: 

  • CHECK FOR AJAX CONTROL TOOLKIT :
      
     This is the first thing you need to check for ,as the error clearly implies missing assembly reference.

   If you have AJAX CONTROL TOOLKIT installed then check for POSSIBILITY 2.

   If you don't have it installed then install by following the steps below.

 STEPS TO INSTALL AJAX CONTROL TOOLKIT:

  • Go to project menu at the top and click 'manage NuGet Packages'




  •  A pop up opens and search for AJAX CONTROL TOOLKIT.
 Install it and run the solution.

 

  • If your error is disappeared then its well and good !! Else follow the steps as given in POSSIBILITY 2. !!

 POSSIBILITY 2:

  • STEP 1:


      OOPS!! You may have a problem in registering the ASSEMBLY of  AJAX CONTROL TOOLKIT.
  Here is the detailed explanation of what is meant by 'registering the assembly'

  As soon as you had installed the AJAX CONTROL TOOLKIT check the following lines in web.config file

 <configuration>
      <system.web>
       ...... 
            <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"><controls>
                 <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"                    namespace="AjaxControlToolkit" />
                 <add tagPrefix="asp" namespace="System.Web.UI.WebControls"   assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                  </controls>
            </pages>
    </system.web>
.........
 <configuration>

You must find the following lines under the tag 'pages' or search for it

Note:
The dotted lines indicates the missing lines .I have shown only the necessary files for this article because it will be bit confusing as to where the assembly tag for this ajax resides.So have shown you the possible order of it !!

  • STEP 2:

   If you can find the above tags in your web.config file then start your hunt in search of the keyword 'Register' . 
  
  You may have a particular .aspx page where you have used AJAX (coding in AJAX) .Say you have used ajax in a page 'PaintBrush.aspx' then ,
  
Check for the highlighted line of code below at the top of  PaintBrush.aspx page.It is the line that registers AJAX CONTROL TOOLKIT. If you have that particular line its well and good ! But don't stop there. TagPrefix="asp" plays a main role here.!! 


  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaintBrush.cs" Inherits="xxx.PaintBrush" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>      ................. important line....................
 <!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml">
        <head runat="server">
                <title>Paint Brush</title>
                      <body>
                          <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"     EnablePageMethods="true">
                         </asp:ToolkitScriptManager>
                    </body>
             </html>


The value of Tagprefix must be same as that for ToolkitScriptManager. 
  ie.





If in your file,the above mentioned tag is not same then change it .Save changes made and run the solution.If the error persists,check the POSSIBILITY 3

POSSIBILITY 3:

 Omg!! You may have issues in toolbox.Check the following steps...

  •  STEP 1:
         Under toolbox right click general and choose 'add tab' 
         Give it a name say 'ajax'





  •   STEP 2: 
            Right click newly created tab 'ajax' and click on 'choose items' .
            A pop up opens as shown below 




  •  STEP 3:
        Click on 'browse'  and check for AjaxControlToolkit.dll . Click ok and let it install!!





 If you don't find it then you must download it. 

 TO DOWNLOAD AJAX  CONTROL TOOLKIT.dll FOR VISUAL STUDIO :

   Go to this link AjaxControlToolkit.dll and download it for the appropriate framework you are using in VisualStudio.

  Extract it and save it it folder.Follow steps as in steps 2 and 3.

  Save changes and run the solution.

  Clap your hands if you find no more errors. :)
  
CONCLUSION:

 These are the possible solutions to swipe out your error. Its been one of the errors which I have come across. Hope this article is helpful to you.Leave out your valuable comments and help me improvise !!Stay updated with my upcoming articles too !! Happy coding :)

     
     


How to backup and Restore a complete database in Microsoft SQL Server Management Studio ?

INTRODUCTION

      In this article I have explained the complete way to backup a database in MSSQL with screenshots.Its really important to backup our database before performing crucial tasks like formatting our system etc.Still,Its not a difficult as many of us assume.(Initially I  too assumed that it was a big task and thought it might ruin my full day but I wondered at last that I completed backup in seconds :D I will make you people too wonder with this article) Here are the list of steps.. 
   
Note: I have explained as per the version of MSSQL 2012 .


STEPS TO BACKUP A DATABASE:


  •    STEP 1:


  Right click the database you wish to backup.Select Tasks and select backup



  • STEP 2: 


A pop up opens as below and without performing any changes click on "add"




  • STEP 3:  

     Leave the destination folder as such because the default one would be the one "backup" folder (It will be under the folder where you had installed your MSSQL).For the safer side,let your  backup get saved under "backup" folder itself






  • STEP 4:  

   Click on 'OK' and you will get a popup regarding the status of your backup(success or failure)


STEPS TO RESTORE YOUR DATABASE:


  • STEP 1:


     To restore the database,Right click database and select restore



  • STEP 2:


   A pop up appears as below .As a default database will be selected but you need to choose 'device' as your backup file resides only on your device.Direct it to the folder where you have saved your backup file(It will be under backup folder as a default) If you had saved in some other folder then direct it accordingly.



                                                                                 


  • STEP 3:


   Click on 'OK' and your database file is successfully restored now.!!


CONCLUSION:

         
    So here it is!! You have successfully made a backup and restored it in you database!! Wasn't it easy? :) Make sure you do backup on a regular basis and if possible take the screen shots of your tables and stored procedures. I took a backup of database in  a wrong way still I had my screenshots with me and so got my db back .So,I felt like sharing the right way to take the backup :)
    Hope this article is helpful to you..!! Leave out your valuable feedback and help me improvise !! Stay updated with my upcoming articles !! 
   Happy coding :)