Sunday, 14 December 2014

Insert ,Update,Edit,Delete In Gridview










Page.aspx

<asp:GridView ID="GridView1" runat="server" style="height:100px; overflow:auto" AutoGenerateColumns="False" 
        DataSourceID="sqldsEmpDetails" onrowcancelingedit="GridView1_RowCancelingEdit" 
        onrowediting="GridView1_RowEditing" onrowupdating="GridView1_RowUpdating" 
        DataKeyNames="id" onrowdeleting="GridView1_RowDeleting" 
        onrowcommand="GridView1_RowCommand" onrowcreated="GridView1_RowCreated" 
        ShowHeader="False">
        <Columns>
            <asp:TemplateField HeaderText="Edit">
                <EditItemTemplate>
                    <asp:LinkButton ID="lkbtnUpdate" runat="server" CommandName="Update" 
                        CommandArgument='<%# Eval("Id") %>'>Update</asp:LinkButton>
                    <asp:LinkButton ID="lkbtnCancal" runat="server" CommandName="Cancel">Cancal</asp:LinkButton>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:LinkButton ID="lkbtninsert" runat="server" CommandName="AddNew" 
                        ValidationGroup="Insert">Insert</asp:LinkButton>
                    <asp:LinkButton ID="lkbtncancel" runat="server" onclick="lkbtncancel_Click">Cancel</asp:LinkButton>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="lkbtnEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton>
                    <asp:LinkButton ID="lkbtnDelete" runat="server" 
                        CommandArgument='<%# Eval("id") %>' CommandName="Delete" 
                        onclientclick="javascript:return DeleteItem();">Delete</asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Name">
                <EditItemTemplate>
                    <asp:TextBox ID="txtname" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="*" ForeColor="Red" 
                        ValidationGroup="Insert"></asp:RequiredFieldValidator>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Addresse">
                <EditItemTemplate>
                    <asp:TextBox ID="txtAddresse" runat="server" Text='<%# Eval("Addresse") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                        ControlToValidate="TextBox2" ErrorMessage="*" ForeColor="Red" 
                        ValidationGroup="Insert"></asp:RequiredFieldValidator>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lbladresse" runat="server" Text='<%# Eval("Addresse") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Cell">
                <EditItemTemplate>
                    <asp:TextBox ID="txtcell" runat="server" Text='<%# Eval("Cell") %>'></asp:TextBox>
                </EditItemTemplate>
                <FooterTemplate>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ControlToValidate="TextBox3" ErrorMessage="*" ForeColor="Red" 
                        ValidationGroup="Insert"></asp:RequiredFieldValidator>
                </FooterTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblcell" runat="server" Text='<%# Eval("Cell") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Id" Visible="False">
                <EditItemTemplate>
                    <asp:TextBox ID="txtid" runat="server" Text='<%# Eval("ID") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lblid" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <HeaderStyle CssClass="FixedHeader" />
    </asp:GridView>


<asp:Button ID="btnnewrow" runat="server" onclick="btnnewrow_Click" 
        Text="Add New" />

 <script type="text/javascript">
//conformation box for Delete
    function DeleteItem() {
        if (confirm("Are you sure you want to delete ...?")) {
            return true;
        }
        return false;
    }
 </script>

Page.CS  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Common;
using System.Data;
using MySql.Data.MySqlClient;

public partial class _Default : System.Web.UI.Page
{
    MySqlConnection conn = new MySqlConnection();
    MySqlCommand cmd = new MySqlCommand();
    MySqlDataAdapter adp = new MySqlDataAdapter();
    sendmail objmail = new sendmail();
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = string.Empty;
        conn = new MySqlConnection("Server=localhost ;Database=emp ;Uid=root;Pwd=send;");
        conn.Open();
        Bind();
    }

    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
 GridView1.EditIndex = e.NewEditIndex;
 GridView1.DataBind();
    }
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        LinkButton lk = (LinkButton)GridView1.Rows[e.RowIndex].FindControl("lkbtnUpdate");
        string id = lk.CommandArgument.ToString();

       // string iidd = Gvempdetails.DataKeys[e.RowIndex].Value["id"];
      //  int id = Convert.ToInt32(Gvempdetails.DataKeys[e.RowIndex].Item["youfield"].tostring());
       // TextBox id = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtid");
        TextBox name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtname");
        TextBox Address = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtAddresse");
        TextBox cell = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtcell");
        string SaveQuery = "UPDATE empdetails SET NAME='" + name.Text + "',addresse='" + Address.Text + "',Cell=" + cell.Text + " WHERE id=" + id + "";
        
        //cmd = new MySqlCommand(SaveQuery, conn);
        //cmd.ExecuteNonQuery();
       sqldsEmpDetails.UpdateCommand = SaveQuery;
       sqldsEmpDetails.Update();
        GridView1.EditIndex = -1;
        GridView1.DataBind();
    }
    protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        GridView1.EditIndex = -1;
        GridView1.DataBind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string test = GridView1.DataKeys[e.RowIndex].Value.ToString();
        LinkButton lk = (LinkButton)GridView1.Rows[e.RowIndex].FindControl("lkbtnDelete");
        string id = lk.CommandArgument.ToString();
        sqldsEmpDetails.DeleteCommand = "Delete From empdetails where id="+id+"";
        sqldsEmpDetails.DataBind();
        GridView1.DataBind();
    }

protected void btnnewrow_Click(object sender, EventArgs e)
    {
        GridView1.ShowFooter = true;
    }


 protected void lkbtncancel_Click(object sender, EventArgs e)
    {
        GridView1.ShowFooter = false;
    }


public void Bind()
    {
        DataSet ds= new DataSet();
        adp = new MySqlDataAdapter("SELECT id,NAME,Addresse,Cell FROM empdetails  ORDER BY NAME ASC", conn);
        adp.Fill(ds, "c");
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();
    }
}







Saturday, 6 December 2014

SQL Server ranking functions

In SQL Server there is 4 ranking functions:
ROW_NUMBER
Returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question.
RANK
Returns the rank of each row within the partition of a result set. The rank of a row is one plus the number of ranks that come before the row in question.
DENSE_RANK
Returns the rank of rows within the partition of a result set, without any gaps in the ranking. The rank of a row is one plus the number of distinct ranks that come before the row in question.
NTILE
Distributes the rows in an ordered partition into a specified number of groups. The groups are numbered, starting at one. For each row, NTILE returns the number of the group to which the row belongs.
below is the syntax:
ROW_NUMBER ( )     OVER ( [ <partition_by_clause> ] <order_by_clause> )
RANK ( )    OVER ( [ < partition_by_clause > ] < order_by_clause > )
DENSE_RANK ( )    OVER ( [ < partition_by_clause > ] < order_by_clause > ) 
NTILE (integer_expression)    OVER ( [ <partition_by_clause> ] < order_by_clause > )



Saturday, 29 November 2014

Three Tire

Page.aspx


Page.aspx.cs

    protected void btnsubmit_Click(object sender, EventArgs e)
    {


        BLClass _b = new BLClass();
        Info _I = new Info();
        _I._p_Fullname = txtFullname.Text;
        _b.InsertUserInformation(_I);
    }

BLClass

public class BLClass
{
public BLClass()
{
}

    //SQL Connection string
    string ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["empConnectionString"].ToString();

    #region Insert User Details
   
    public string InsertUserInformation(Info _I)
    {
        SqlConnection con = new SqlConnection(ConnectionString);
        con.Open();
        SqlCommand cmd = new SqlCommand("spname", con);
        cmd.CommandType = CommandType.StoredProcedure;
        try
        {
            cmd.Parameters.AddWithValue("@Fullname", _I._p_Fullname);
            cmd.Parameters.AddWithValue("@f", "I");
            
            cmd.ExecuteNonQuery();
            
            con.Close();
            string i = "0";
            return i;
        }
        catch (Exception ex)
        {
            throw ex;
        }
        finally
        {
            cmd.Dispose();
            con.Close();
            con.Dispose();
        }
    }
    #endregion
}

Info

public class Info
{       
    
        private string _Fullname;
        public string _p_Fullname
        {
            get
                {return _Fullname;}
            set{_Fullname=value;}
        }
public Info()
{
}
}


Sunday, 2 November 2014

Page Life Cycle Events

·     PreInit : PreInit is the first event in page life cycle. It checks the IsPostBack property and determines whether the page is a postback. It sets the themes and master pages, creates dynamic controls and gets and sets profile property values. This event can be handled by overloading the OnPreInit method or creating a Page_PreInit handler.

·  Init : Init event initializes the control property and the control tree is built. This event can be handled by overloading the OnInit method or creating a Page_Init handler.

·   InitComplete : InitComplete event allows tracking of view state. All the controls turn on view-state tracking.

·   LoadViewState : LoadViewState event allows loading view state information into the controls.

· LoadPostData . During this phase, the contents of all the input fields defined with the <form> tag are processed.

· PreLoad . PreLoad occurs before the post back data is loaded in the controls. This event can be handled by overloading the OnPreLoad method or creating a Page_PreLoad handler.

· Load . the Load event is raised for the page first and then recursively for all child controls. The controls in the control tree are created. This event can be handled by overloading the OnLoad method or creating a Page_Load handler.

· LoadComplete . the loading process is completed, control event handlers are run and page validation takes place. This event can be handled by overloading the OnLoadComplete method or creating a Page_LoadComplete handler.

· PreRender . the PreRender event occurs just before the output is rendered. By handling this event, pages and controls can perform any updates before the output is rendered.

·  PreRenderComplete . as the PreRender event is recursively fired for all child controls, this event ensures the completion of the pre-rendering phase.

· SaveStateComplete . state of control on the page is saved. Personalization, control state and view state information is saved. The HTML markup is generated. This stage can be handled by overriding the Render method or creating a Page_Render handler.

·  UnLoad . the UnLoad phase is the last phase of the page life cycle. It raises the UnLoad event for all controls recursively and lastly for the page itself. Final cleanup is done and all resources and references, such as database connections, are freed. This event can be handled by modifying the OnUnLoad method or creating a Page_UnLoad handler.

Friday, 3 October 2014

Array list and Hash table

1.ArrayList  represents the ordered collection of an object or it can be said that it is individually indexed where as Hash table uses a key to access the elements in the collection.
2.ArrayList is used when you want to access the elements by using index where as Hash table is used when you must access elements by using an index.
Array list
Hash table
using System;
using System.Collections;
class Program
{
  static void Main()
    {
// Create an ArrayList and add two ints.
ArrayList list = new ArrayList();
        list.Add(5);
        list.Add(7);
// Use ArrayList with method.
Example(list);
    }

    static void Example(ArrayList list)
    {
        foreach (inti in list)
        {
        Console.WriteLine(i);
        }
    }
}Output
5
7
using System;
using System.Collections;
class Program
{
static void Main()
{
Hashtablehashtable = new Hashtable();
hashtable[1] = "One";
 hashtable[2] = "Two";
hashtable[13] = "Thirteen";
foreach (DictionaryEntry entry in hashtable)
{
     Console.WriteLine("{0}, {1}", entry.Key, entry.Value);
}
}
}
Result
13, Thirteen
2, Two
1, One



Sunday, 7 September 2014

To Identify Deleted Id in SQL Server

select number from master..spt_values s left join TableName b on s.number=b.Id
where s.type='p' and s.number<(select (MAX(Id)) from TableName) and b.Id is null

Saturday, 6 September 2014

On Button Click Processing Method




 protected void Page_Load(object sender, EventArgs e)
    {
        this.btnsubmit.Attributes.Add("onclick", DisableTheButton(this.Page, this.btnsubmit));
    }

 #region Button wait event
    private string DisableTheButton(Control pge, Control btn)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append("if (typeof(Page_ClientValidate) == 'function') {");
        sb.Append("if (Page_ClientValidate() == false) { return false; }} ");
        sb.Append("this.value = 'Processing...';");
        sb.Append("this.disabled = true;");
        sb.Append(Page.GetPostBackEventReference(btn));
        sb.Append(";");
        return sb.ToString();
    }
    #endregion

Sunday, 31 August 2014

Maximum length of Querystring

Maximum length of Querystring is based on the browser not depend upon the asp.net.
Maximum length of a querystring in IE 4.0 and above is ~2048 characters

IE. 4,5,6,7, - 2,048 characters.
Opera supports - 4050 characters.
Netscape 6 supports - 2000 characters.
Firefox Supports - 6000 characters 


HTML5 Pattern

Name Pattern

1.Alpha-Numeric  -  [a-zA-Z0-9]+
2.Username with 2-20 chars  - ^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$

Password Pattern

1.Password (UpperCase, LowerCase, Number/SpecialChar and min 8 Chars)

Pattern= (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$

2.Password (UpperCase, LowerCase and Number)

Pattern = ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$

Phone Pattern

Pattern=[\+]\d{2}[\(]\d{2}[\)]\d{4}[\-]\d{4}

Date Pattern

Pattern= (0[1-9]|1[0-9]|2[0-9]|3[01]).(0[1-9]|1[012]).[0-9]{4}
Format ex:  DD.MM.YYYY

Pattern=[0-9]{4}-(0[1-9]|1[012])-(0[1-9]|1[0-9]|2[0-9]|3[01])
Format ex:  YYYY-MM-DD

Sunday, 24 August 2014

HTML5 for TextBox



<asp:TextBox ID="txtName" runat="server" placeholder="Name" required="a" title="Enter the Name" pattern="[a-zA-Z]+"></asp:TextBox>

when submit the textbox as  empty validation Required

Title is for small alert Message  for the user.
Placeholder is the small Description of the Input which is needed .
Required is  the Required Field Validation
Pattern  Checking for input 

Cursor in SQL

DECLARE @Id int
DECLARE @name varchar(50)
DECLARE cur_emp CURSOR
STATIC FOR SELECT Sno,Name from EmpName
OPEN cur_emp
IF @@CURSOR_ROWS > 0
 BEGIN
 FETCH NEXT FROM cur_emp INTO @Id,@name
 WHILE @@Fetch_status = 0
 BEGIN
 -- select @Id,@name
 PRINT 'ID : '+ convert(varchar(20),@Id)+', Name : '+@name
 FETCH NEXT FROM cur_emp INTO @Id,@name
 END
END
CLOSE cur_emp
DEALLOCATE cur_emp


Output :

ID : 1, Name : Sendhilkumar
ID : 2, Name : ArunKumar
ID : 3, Name : BBBB

Syntax to Declare Cursor
Declare Cursor SQL Comaand is used to define the cursor with many options that impact the scalablity and loading behaviour of the cursor. The basic syntax is given below
  1.  DECLARE cursor_name CURSOR
  2.  [LOCAL | GLOBAL] --define cursor scope
  3.  [FORWARD_ONLY | SCROLL] --define cursor movements (forward/backward)
  4.  [STATIC | KEYSET | DYNAMIC | FAST_FORWARD] --basic type of cursor
  5.  [READ_ONLY | SCROLL_LOCKS | OPTIMISTIC] --define locks
  6.  FOR select_statement --define SQL Select statement
  7.  FOR UPDATE [col1,col2,...coln] --define columns that need to be updated
Syntax to Open Cursor
A Cursor can be opened locally or globally. By default it is opened locally. The basic syntax to open cursor is given below:
  1.  OPEN [GLOBAL] cursor_name --by default it is local
Syntax to Fetch Cursor
Fetch statement provides the many options to retrieve the rows from the cursor. NEXT is the default option. The basic syntax to fetch cursor is given below:
  1.  FETCH [NEXT|PRIOR|FIRST|LAST|ABSOLUTE n|RELATIVE n]
  2. FROM [GLOBAL] cursor_name
  3. INTO @Variable_name[1,2,..n]
Syntax to Close Cursor
Close statement closed the cursor explicitly. The basic syntax to close cursor is given below:
  1.  CLOSE cursor_name --after closing it can be reopen
Syntax to Deallocate Cursor
Deallocate statement delete the cursor definition and free all the system resources associated with the cursor. The basic syntax to close cursor is given below:
  1.  DEALLOCATE cursor_name --after deallocation it can't be reopen


Merging GridView Header Columns Multiple Headers ASP.NET



In Aspx Page
<asp:GridView ID="GridView1" runat="server"  DataSourceID="SqlDataSource1" 
OnRowCreated="GridView1_RowCreated" ShowHeader="False">
<Columns>
<asp:BoundField DataField="DepartMentID" HeaderText="DepartMentID"/>
<asp:BoundField DataField="DepartMent" HeaderText="DepartMent"/>
<asp:BoundField DataField="Name" HeaderText="Name"/>
<asp:BoundField DataField="Location" HeaderText="Location"/>
</Columns>
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [DepartMentID], [DepartMent], [Name], 
              [Location] FROM [Employee]">
</asp:SqlDataSource>


In C#
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.Header)
        {
            GridView HeaderGrid = (GridView)sender;
            GridViewRow HeaderGridRow = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Insert);
            TableCell HeaderCell = new TableCell();
            HeaderCell.Text = "Department";
            HeaderCell.ColumnSpan = 2;
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "Employee";
            HeaderCell.ColumnSpan = 2;
            HeaderGridRow.Cells.Add(HeaderCell);

            GridView1.Controls[0].Controls.AddAt(0, HeaderGridRow);

   HeaderGridRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
            HeaderCell = new TableCell();
            HeaderCell.Text = "DepartMentID";
            HeaderCell.RowSpan = 1;
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "DepartMent";
            HeaderCell.RowSpan = 1;
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "Name";
            HeaderCell.RowSpan = 1;
            HeaderGridRow.Cells.Add(HeaderCell);

            HeaderCell = new TableCell();
            HeaderCell.Text = "Location ";
            HeaderCell.RowSpan = 1;
            HeaderGridRow.Cells.Add(HeaderCell);

            GridView1.Controls[0].Controls.AddAt(1, HeaderGridRow);

        }
    }

Saturday, 23 August 2014

CodeBehind And CodeFile

CodeBehind : Needs to be compiled  and compiled binary is placed in the bin folder of the website. You need to do a compile in visual studio before you deploy. Good model when you do not want the source code to be viewable as plain text ... for example when delivering to a customer who you not have obligation to provide code.

CodeFile : You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsoft.NET[.NET version]\Temporary ASP.NET Files.

Delegates

Suppose if you have multiple methods with same signature (return type & number of parameters) and want to call all the methods with single object then we can go for delegates.
Delegates are two types
      -   Single Cast Delegates
      -  Multi Cast Delegates

Example:
public delegate int DelegatSample(int a,int b);
public class Sampleclass
{
public int Add(int x, int y)
{
return x + y;
}
public int Sub(int x, int y)
{
return x - y;
}
}
class Program
{
static void Main(string[] args)
{
Sampleclass sc=new Sampleclass();
DelegatSample delgate1 = sc.Add;
int i = delgate1(10, 20);
Console.WriteLine(i);
DelegatSample delgate2 = sc.Sub;
int j = delgate2(20, 10);
Console.WriteLine(j);
}
}


Assembly

“An assembly may be Public or Private. A public assembly is also called a Shared Assembly.” 

1.The .NET assembly is the standard for components developed with the Microsoft.NET. 
2.Dot NET assemblies may or may not be executable, i.e., they might exist as the executable (.exe) file or dynamic link library (DLL) file.
3.All the .NET assemblies contain the definition of types, versioning information for the type, meta-data, and manifest. The designers of .NET have worked a lot on the component (assembly) resolution.
Advantages of Assemblies
1.        In the case of DLLs if a DLL has to be shared with some other application, it has to be registered in that particular machine. But, In the case of Asp.net assemblies there is no such type of registration required. Here we just need to do is to copy the assembly and put in the bin directory of the application that is going to use it.
2.        If we need to share a particular assembly with any other applications. we can do so by placing the assembly in the Global Assembly Cache (GAC). But before we going to do it we need to give a strong name to that assembly.Strong name is similar to GUID(It is supposed to be unique in space and time) in COM, components.Strong Name is only needed when we need to deploy assembly in Global Assembly Cache (GAC).Strong Names helps GAC to differentiate between two versions.Strong names use public key cryptography (PKC) to ensure that no one can spoof it.PKC use public key and private key concept.
3.        Another advantage of using ASP.Net assemblies is the ability to read the contents of an assembly. Each assembly has a manifest that has details about the assembly itself.
4.        The System.Reflection namespace has classes like Assembly which can be used to get the details of the assembly and with that it is also possible to load an assembly dynamically at runtime.

There are three types of assemblies in .NET
Private Assemblies
Public/Shared Assemblies.
Satellite Assembly

Private Assemblies

Is the assembly which is used by application only, normally it resides in your application folder directory.

There is no version constraint in private assembly.

If an assembly is copied in to the respective application in which we would like to use is known as local assembly. if any changes made to the copy that will not reflect the copies in other applications.

 Public Assemblies

It resides in GAC, so that anyone can use this assembly. Public assemblies are always share the common.
It has version constraint.
This public assembly is stored inside the global assembly cache or GAC.GAC contains a collection of shared assemblies.
If an assembly is copied into the global place and reference is used from all other applications then this is called public or global assembly..if we want to copy assembly in global place we have to create strong name by using sn.exe.

Satellite Assembly
Satellite assemblies are used to build multi-linguistic applications. Application which has built in supportive of more than one human readable language is known as multi-linguistic applications.
Satellite Assemblies doesn’t contain any Data
Satellite assembly is containing cultural information.
Satellite assembly mainly used for to display information based on the Cultural setting of browser or region.

Suppose you developed your application in an English (en-US) locale. Now, your application has multilingual support. When you deploy your code in different location, for example in India, you want to show text, label messages in the national language (local language) which is other than English.

Satellite assemblies give this flexibility. You create any simple text file with translated strings, create resources, and put them into the bin\debug folder. That's it. The next time, your code will read the CurrentCulture property of the current thread and accordingly load the appropriate resource.