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