February 6, 2016

invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Reason: There are multiple scenario in which this error come.


if we try to change the property of asp.net control through the Javascript after page load then above issue comes.

This error might be coming from one of the user control present on the page
(Search or header)

Or

forgot to add an ID to a dynamically created control.

Or
check design contain two nested <form></form> tag

Or
other......

Solution:

Remove two nested <form></form> tag

OR
<pages validateRequest="false" enableEventValidation="false" />
and do Toolscriptmanager partial rendering is enabled

OR
IsPostBack in page load

OR
Use update panel which attribute is changing due to javascript

OR
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(buton1);

OR
Other...........

February 1, 2016

Base Class In asp.net

content copied .....

The class whose members are inherited is called the base class, and the class that inherits those members is called the derived class. A derived class can have only one direct base class. However, inheritance is transitive. If ClassC is derived from ClassB, and ClassB is derived from ClassA, ClassC inherits the members declared in ClassB and ClassA.

When you derive a class from a base class, the derived class will inherit all members of the base class except constructors. The Derived class re-use the code of base class based on accessibility level of those member.


Example Of Base Class :

public class Clsbase : System.Web.UI.Page
{  
    protected override void OnLoad(EventArgs e)
    {       
        Response.Write("From base class");
        base.OnLoad(e);
    }  
}



Example Of Derived Class :

public partial class ClsDerived : Clsbase

    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("From Derived Class");    
    }
}