Wednesday, July 25, 2012

CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced.

When  using  Entity frame work . passing  the  data  with control i got  one error 

"Compiler Error Message: CS0012: The type 'System.Data.Objects.DataClasses.EntityObject' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'."

After  R & D  i  found  solution. so  i  am  posting  this  solutions because i don't  want  to  waste  your lot  of  time like as  i  did.

here  is  solution type following code  in  your web config  file  


" "

Thanks  Happy Coding

Tuesday, July 17, 2012

Hide/Show Div With Smooth Effect.

Hi  i am  giving you  one example to show  and hide  div with smooth effect .

My html Code:

<div id="done" style="display:none;">
write content here
</div>
My Java Script Code
<script>

 $('#done').fadeIn('slow');

                setTimeout(function () {
                    $('#done').fadeOut('slow');
                }, 2000);
</script>








Happy  Coding

Wednesday, July 11, 2012

How to Define action Link Using Areas In MVC

Hi..

I  am  giving  one example to  define Action Link Url Using Multiple Areas..

I am  using two areas with Name
a) Control
b) System
.

 
  • @Html.ActionLink("Main Home", "Index", "Home", new { Area = "" }, null)

  •  
  • @Html.ActionLink(" Control Home", "Index", "ControlHome", new { Area = "Control" }, null)

  •  
  • @Html.ActionLink(" System Home", "Index", "SystemHome", new { Area = "System" }, null)





  • Happy  Coding

    Monday, July 9, 2012

    Import Excell,csv file into Linq

    I  have csv file with name infocontext,  having two fileds

    1.Alies
    2. ShortDesc

    Now i  am  importing My Excel data from csv file to database using Linq  (Entity Framework in MVC3)

    I  have table Infocontext

    1. Create properties of class for Table

    --->
     public class InfoContext
        {
                         public string Tag { get; set; }
                         public string Alias { get; set; }
         }

    2.  Now Write this Method

     public ActionResult ImportCSV()
            {
              // Object of My Class
     InfoContext Dtinfo = new InfoContext();


               // Import  data  from csv file
     var dataImport = System.IO.File.ReadAllLines(Server.MapPath("~/Areas/Cataloging/infocontext.csv"));
                
                for(int i=0;i<=dataImport.Length;i++)
                {

                 // Split data from Excel by  column
                    string[] word = dataImport[i].Split(',');
                    for(int k=0;k<=word.Length-1;i++)
                    {


                        Dtinfo.Alias = word[0];
                        Dtinfo.ShortDesc = word[1];
                         db.InfoContext.Add(Dtinfo);  // Saving data  by  code  first tech. you can write your own method to save data

                        db.SaveChanges();
                    }
                }

                return View();


            }


    Data  is   Saved..

    Happy Programing

    Saturday, June 9, 2012

    Google Map in 3d

    Now  explore   your  Maps View  in 3d  with  New  Google 3d Map 6.0.

    Features
    • Tilt
    • Rotate
    • Compass Mode
    • Smooth Zooming
    • Offline Reliability 
    • Offline Building  and Rerouting
    Source :  Google.com

    Friday, June 8, 2012

    Write a program to list files in the current working directory depending upon a given pattern.?


    ♣♣♣ WRITE A PROGRAM TO LIST FILES IN THE CURRENT WORKING DIRECTORY DEPENDING UPON A GIVEN PATTERN. ♣♣♣


      import java.lang.*;
      import java.io.*;

      class pro15
    {
      public static void main(String ar[]) throws IOException
            {
                                        InputStreamReader a=new InputStreamReader(System.in);
                                        BufferedReader b=new BufferedReader(a);
                                        System.out.print("\n\tEnter the Directory Name : ");
                String s=b.readLine();
                File f=new File(s);
                if(f.exists())
                {
                            if(f.isDirectory())
                            {
                            String []f1=f.list();
                            int i;
                                        for(i=0;i
                                        {
                                        String tp=f1[i];
                                        if(tp.endsWith("java"))
                                        System.out.println("\n\t\t"+tp);
                                        if(tp.endsWith("class"))
                                        System.out.println("\n\t\t"+tp);
                                        }
                            }
                 }
            }
    }


    OUTPUT :-
                                       
                            Enter The Directory Name : d:\

                                        Test.java
                                        Test.class
                                        Abc.java
                                        Abc.class
                                        Applet2.java

    Write a program to get a file name at run time and display number of lines and words in that file.?


    ♣♣♣ WRITE A PROGRAM TO GET A FILE NAME AT RUN TIME AND DISPLAY NUMBER OF LINES AND WORDS IN THAT FILE. ♣♣♣


    import java.lang.*;
    import java.io.*;

    class pro14
    {
            public static void main(String ar[]) throws IOException
            {
            InputStreamReader a=new InputStreamReader(System.in);
            BufferedReader b=new BufferedReader(a);
            int lines=0,words=0;
            System.out.print("\n\tEnter The File Name : ");
            String s=b.readLine();
            File f=new File(s);
            InputStreamReader in=new InputStreamReader(new FileInputStream(f));
                            StreamTokenizer st=new StreamTokenizer(in);
                                                                            st.wordChars(0,255);
                                            st.whitespaceChars(0,' ');
                                            st.eolIsSignificant(true);
                                            while(st.nextToken()!= st.TT_EOF)
                                            {
                                                    if(st.ttype==st.TT_EOL)
                                                                lines++;
                                                    if(st.ttype==st.TT_WORD)
                                                        words++;
                                            }
                 System.out.println("\n\tNumber of Lines : "+lines+"\n\t Number of words : "+words);

            }
    }


    OUTPUT :-
                                       
                            Enter The File Name : c:\test.txt
                           
                            Number of Lines : 0
                            Number of Words : 2

                            Enter The File Name : c:\hook.log
                           
                            Number of Lines : 238
                            Number of Words : 357