4 April 2013

Difference between PostBackTrigger and AsyncPostBackTrigger in ASP.NET

 Difference between PostBackTrigger and AsyncPostBackTrigger in ASP.NET


Specifies a control and event that will cause a partial page update for the UpdatePanel that contains this trigger reference.
Specifies a control and event that will cause a full page update (a full page refresh). This tag can be used to force a full refresh when a control would otherwise trigger partial rendering.

PostBackTrigger

Use the PostBackTrigger control to enable controls inside an UpdatePanel to cause a postback.


Uses of AsyncPostBackTrigger
  • For controls that are outside a panel.
  • For controls that are inside a panel when the ChildrenAsTriggers property is false.
  • For controls that are inside nested panels, in order to cause a refresh of parent panels.

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.

17 February 2013

MVC Video Tutorial Collection

MVC Video Tutorial Collection

Pros and Cons of  ASP.NET MVC





MVC Beginner to Expert


9 February 2013

Setting the Default Page or Route in MVC application

Setting the Default Page or Route in MVC application


For convenience, we are going to tell MVC that requests to the / URL for our application should be
directed to the Index action method of the Product controller. To do this, open the Global.asax file and 
find the RegisterRoutes method. In this method, there is a call to routes.MapRoute. Change the value 
assigned to the controller property from Default to Product,





Setting the Controller for the Default Route
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Product", action = "Index", id = UrlParameter.Optional }
)




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...