The page_load method
which is defined in aspx page or design page will only run. Design page
page_load method precedence is more.
Friday 29 July 2016
What is the significance of AutoEventWireUp in asp.net?
Gets or
sets a value indicating whether events for ASP.NET pages are automatically
connected to event-handling functions.
If AutoEventWireUp attribute is true then asp.net apges automatically
connected to event-handling function, otherwise not.
The default value of AutoEventWireUp
id true.
When AutoEventWireup is true,
ASP.NET does not require that you explicitly bind event handlers to a page
event such as Load.
When AutoEventWireup is false,
you must explicitly bind the event to a method. For example, if you have a Page_Load method in the code for a page, the
method will be called in response to the Load event
only if you write code like that in the following example.
Example:-
Here AutoEventWireUp attribute value is false.
protected void Page_Load(object
sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToLongTimeString();
}
For above example AutoEventWireup is false, so it
will not show date on label control on web page.
Note:-
- If you set AutoEventWireup to true, make sure that you do not also manually attach page event handlers to events. If you do, handlers might be called more than one time.
- Automatic binding is performed only for page events, not for events for controls on the page.
- As an alternative to binding events to handlers, you can override the Oneventname methods of the page or of controls.
Wednesday 27 July 2016
Like operator in Linq using c#.
There are following
ways to achieve like operator in Linq
1.) Using StartsWith :-
var studentList = from s in Students where s.Stud_sname.StartsWith("M") select s
2.) Using EndsWith :-
var studentList = from s in Journals where s.Stud_sname.EndsWith("T") select s
3.) Using SqlMethods :-
For this use have to use System.Data.SqlClient namespace
Var studentList = from m in Journals where SqlMethods.Like(s.Stud_sname,"Ram%") select s
4.) Using Contains :-
var studentList = from s in Journals where s.Stud_sname.Contains("Ram") select m
Tuesday 26 July 2016
What will happen if we declare DataMember attribute as static On DataContract in WCF?
DataMemberAttribute
attribute is ignored if it is applied to static member.
Subscribe to:
Posts (Atom)