28 March 2013

Multiple File Upload JQuery Asp.net

Multiple File Upload JQuery Asp.net in C#

MultipleFileUpload.aspx.cs


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MultipleFileUpload.aspx.cs"
    Inherits="MultipleFileUploadJquery.MultipleFileUpload" %>

Include the below script

    < script src="Scripts/jquery-1.8.2.js" type="text/javascript">
    < script src="Scripts/jquery.MultiFile.js" type="text/javascript">

Code

    < form id="form1" runat="server">
    < div >
       
         < asp:FileUpload ID="file_upload" class="multi" runat="server"  / >
        < asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" / >
        < asp:Label ID="lblMessage" runat="server" / >
       
    < /div >
    < /form >
< /body >
< /html >


MultipleFileUploadJquery,aspx.cs

using System;
using System.IO;
using System.Web;

namespace MultipleFileUploadJquery
{
    public partial class MultipleFileUpload : System.Web.UI.Page
    {  

        protected void btnUpload_Click(object sender, EventArgs e)
        {
            HttpFileCollection fileCollection = Request.Files;
            for (int i = 0; i < fileCollection.Count; i++)
            {
                HttpPostedFile uploadfile = fileCollection[i];
                string fileName = Path.GetFileName(uploadfile.FileName);
                if (uploadfile.ContentLength > 0)
                {
                    uploadfile.SaveAs(Server.MapPath("~/UploadFiles/") + fileName);
                    lblMessage.Text += fileName +""+ "Saved Successfully";
                }
            }
        }

    }
}


Multifile upload Code in C# Visual Studio 2010 are in the following path

http://sdrv.ms/103livW







23 March 2013

Saving Changes Is Not Permitted On SQL Server 2008 Management Studio.


Saving Changes Is Not Permitted On SQL Server 2008 Management Studio. 

Saving changes is not permitted occurs when doing alter table (table structure is changed):
Change data type on existing columns
Or change allow nulls on existing columns
 
To allow you to save changes after you alter table, do disable prevent changes:
 
1.Open Microsoft SQL Server Management Studio 2008
2.Click Tools, then click Options
3.Click Designers
4.Uncheck prevent saving changes that require table re-creation
5.Click OK
6. Try to alter your table


10 March 2013

OOPS Object Oriented Programming FAQ

OOPS  -  Object Oriented Programming  FAQ

Four main principles of OOPS
1. Encapsulation
2. Inheritance
3. Polymorphism
4. Abstraction

1. Encapsulation
- Encapsulation is the process of hiding the irrelevant information and showing only relevant information to                  the user.
- Encapsulation is the process of wrapping up of data and member in a class.

Example:
- Only specific method or properties can access the private member of class.
- Data Hiding through the private class access specifier.

Uses:
-Increase the maintainability of the code by showing only relevant information to the User.


2. Abstraction
- Abstraction is the process of hiding the details and exposing only the essential feature of particular concept or object.

Real time example:
Refrigerator:
The process of showing the general information related to the refrigerator is called Abstraction and hiding the complex information from the user is Encapsulation.


3.Inheritance
- Inheritance is the process through which a child class obtain the feature defined its parent class.
- Used for reuse of code and eliminate redundant code.

Types:
- Single, Multilevel, Multiple and Hierarchical.

4.Polymorphism
- One Interface multiple methods
- With the help of Polymorphism we can use one procedure in many ways based on our requirement.

Method Overloading:
-Method according to number and types of parameter.

Operator Overloading:
-Change the functionality of operator.

Runtime Polymorphism
Overriding
-Overriding is the feature that allows derived class to provide a specific implementation of a method that is already provided its base class.

Implementing OAuth validation in a Web API

 I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...