Cross page posting is used to submit a page (page1.aspx) to another page (page2.aspx). However, the user can still able to access the first page’s (page1.aspx) controls, properties etc in the second page (page2.aspx). In order to access the first page’s control, we have to use “Previouspage” property.
Thursday, July 17, 2014
Daily Interview Question #14 : What is Cross-Page Posting?
Sunday, July 13, 2014
Daily Interview Question #13 : What is “Postback”?
In ASP.Net postback means, page posted back itself to the server(IIS) whenever an event triggered. That is, page is submitted to the same url. The event may be a button click or dropdown list changed etc. Postback can be identified by IsPostBack() property, to detect the page object is created due to postback.
Wednesday, June 25, 2014
Daily Interview Question #11 : What are the different Session Modes available in ASP.Net?
Sunday, March 16, 2014
Daily Interview Question #7: Implicit and Explicit Implementation of Interface
This is the most common interview question for experienced professionals.
Normally an interface can be implemented in a class in a normal way which is a implicit implementation. Sometime, we may have same method name in different interfaces. If this is the case, we need to do explicit implementation of the interface method. The main use of explicit implementation is to avoid the ambiguities between the class or method name. In order, to do that the interface name put before that interface’s method.
Below example, shows the implicit and explicit implementation:
namespace ConsoleApplicationC
{
// 2 interfaces with same method name
interface IintegerAdd
{
void Add();
}
interface IfloatAdd
{
void Add();
void Multiply();
}// We implement Both interfaces
class ArithmeticOperation : IintegerAdd, IfloatAdd
{
// Implicit Implementation : There is no name collision so we can implement implicitly
// NOTE : public modifier MUST here
public void Multiply()
{
float a = 1.5f, b = 2.5f;
Console.WriteLine("Float Multiplication is:" + a * b);
}// Explicit Implementation : Explicitly tell the compiler that we implement the interface IintegerAdd
void IintegerAdd.Add()
{
int a = 10, b = 20;
Console.WriteLine("Integer Addition Is:" + (a + b));
}// Explicit Implementation : Explicitly tell the compiler that we implement the interface IfloatAdd
void IfloatAdd.Add()
{
float a = 1.5f, b = 2.5f;
Console.WriteLine("Float Addition Is:" + (a + b));
}
}
class Program
{
static void Main(string[] args)
{
ArithmeticOperation objA = new ArithmeticOperation();
IintegerAdd iobj = (IintegerAdd)objA;
iobj.Add();
IfloatAdd fobj = (IfloatAdd)objA;
fobj.Add();
Console.ReadKey();
}
}
}
Output :
Integer Addition Is:30
Float Addition Is:4
Tuesday, February 4, 2014
Daily Interview Question #6: What are the different types of Constructor in C#?
Below is the list of Constructors available in C#:
1. Default Constructor
2. Parameterized constructor
3. Static Constructor.
By default constructor have “public” as access specifier. A class can have more than one Constructor. In C# “this” keyword is used to access the constructor from another constructor. By default, C# will provide a default constructor if no constructor declared.
Hope this helps!
Tuesday, January 28, 2014
Daily Interview Question #5 : What is the difference between “Method Overloading” and “Method Overriding”?
Method overloading | Method overriding |
method overloading used to achieve “early binding” or “static binding”. | method overriding used to achieve “late (dynamic) binding” or “runtime polymorphism”. |
method overloading means, in a class method can be declared with same method name and with different parameters. | method overriding means, a method defined in base class can be redefined in the derived classes. |
method signature (method name + parameter) must be different in method overloading. | method signature must be same in method override. |
Sample Program:
using system;Output:
using system.collections.generic;
using system.text;
namespace consoleapplicationc
{
//Base class
class baseclass
{
private int add(int a, int b)
{
return a + b;
}
// Overload the Above Method
private float add(float a, float b)
{
return a + b;
}
// virtual method - Indicates this will be override in Child class
public virtual string whereiam()
{
return "In Base Class";
}
}
// Derived Class
class derived : baseclass
{
// Base class Method Override here
public override string whereiam()
{
return "In Derived Class";
}
}
class program
{
static void main(string[] args)
{
// Just create base class reference
baseclass basereference;
// Create Base class Object
baseclass baseobj = new baseclass();
// create object for Derived class
derived derivedobj = new derived();
// Base class reference contains derived object
basereference = derivedobj;
// Now Derived class method called with base ref
string strvalue = basereference.whereiam();
console.writeline(strvalue);
// Now Base class ref contains base object
basereference = baseobj;
string strval = basereference.whereiam();
console.writeline(strval);
console.read();
}
}
}
in derived class
in base class
Monday, January 27, 2014
Daily Interview Questions #4: What is the difference between Abstract Method and Virtual Method?
Abstract Method:
Abstract method specified by “abstract” keyword.
An abstract method contains no definition. Derived class must implement the abstract methods.
Object cannot be created for abstract class. That is abstract class can not be instantiated.
Virtual Method:
Virtual method specified by “virtual” keyword.
Used to implement “Run-Time” polymorphism.
Derived classes not forced to implement the “Virtual” methods that is available in Base class.
The process of redefine the virtual method in a derived class called as “Method Overridding”.
Friday, January 24, 2014
Daily Interview Question #3: What are the MEPs available in WCF?
Thursday, January 23, 2014
Daily Interview Question#2 : What are the events will be fired when the “gridview.DataBind()” method called?
When the Gridview.DataBind() method called, below events are fired in the following order:
- Databinding
- RowCreated (Called for Each row)
- RowDatabound (called for each row)
- DataBound
Wednesday, January 22, 2014
Daily Interview Question #1 : What is Abstract Class?
An abstract class is like a class with some future. That is:
i. It contains at least one or more abstract method(s).
ii. It will always act as a base class.
iii. It cannot be instantiated. That is not possible to create instance for that class.
- Learn By Experience: SMS Gateways
- ASP.Net Forums - FAQ #2 : ASP.Net Project Ideas
- ASP.Net Forums – FAQ #1 : How to enable Adsense in my site?
- Main components of .Net Framework
- ASP.Net Forums–FAQ #6: ASP.Net Session Expired Problem
- How to Send SMS From ASP.Net Web Application?
- Visual Studio Tips & Tricks: 2 – Create Virtual Directory Problem
- Visual Studio Tips & Tricks–10 : How to Change the color theme in Visual Studio 2015?
- CRUD Operation - ASP.Net MVC with ADO.Net
- .Net Architecture