Life cycle when the page processed during a postback The events associated with the relevant page cycle phases are: Page Initialization: Page_Init View State Loading:LoadViewState Postback data processing: LoadPostData Page Loading: Page_Load PostBack Change Notification: RaisePostDataChangedEvent PostBack Event Handling: RaisePostBackEvent Page Pre Rendering Phase: Page_PreRender View State Saving: SaveViewState Page Rendering: Page_Render Page Unloading: Page_UnLoad The processing sequence in which a page is processed during a postback event is: Initializing: During this phase, the server creates an instance of the server control Loading view state: During this phase, the view state of the control posted by the client is reloaded into the new instance of the control. Loading : During this phase, the instance of the control is loaded onto the page object in which it is defined. Loading the postback data : During this phase, the server s...
Method 1: Response.AddHeader To Refresh Web page After every 5 Seconds You can add following code, Response.AddHeader("Refresh", "5"); Cricket Sites, Stock Exchange sites use similar logic :) Method 2: In body Tag, window.setTimeout The 1000 = 1 Second... < body onload ="window.setTimeout('window.location.reload()',1000);" > Method 3: In Meta Tag Theres also a meta tag that you can define on the head, but not sure wheter it refreshes even if the content has not finished loading or if it starts counting when the head section loaded. Code would be something like that: < meta content ="600" http-equiv ="refresh" > Method 4: Timer Control : Microsoft ASP.NET 2.0 AJAX Extensions server control In following example, the timer interval is set to 10 seconds <%@ Page Language="C#" AutoEventWireup="true" %> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN...
Back to Home Execution Stages: For web: HTTP request for Application Incoming request routed to Controller (Perform Routing) The controller processes request and create presentation Model The controller also selects appropriate result (view) Model is passed to View View transforms Model into an appropriate output format (HTML) The response is rendered (HTTP response) Image Courtesy: SlideShare.net Back to Home
Back to Home Model-View-Controller (MVC) is a software architecture pattern. Originally formulated in the late 1970s by Trygve Reenskaug as part of the Smalltalk, MVC architecture works on code reusability and separation of concerns. It was originally developed for desktop Then adapted for internet applications. The Model is the application object, the View is UI presentation, and the Controller defines the way the user reacts to user input from UI. MODEL: - Set of classes that describe the data we are working with - Rules for how the data can be changed and manipulated - May contain data validation rules - Often encapsulate data stored in a database as well as the code used to manipulate the data Most likely a Data Access Layer of some kind VIEW: - Defines how the application’s user interface (UI) will be displayed - Support master views (layouts) - Support sub-views (partial views or controls) - Web: Template to dynamically generate HTML CONTR...
We frequently have requirement like Passing IDs in comma saperated value to the sql server for further processing. Generally what we do is just create loop and get the value from it and ... But SQL 2005 comes up with XQuery. Using this you can easly pass such type of data also some complex thing too. For example... DECLARE @productIds xml SET @productIds ='<Products><id>9</id><id>18</id><id>27</id></Products>' SELECT ParamValues.ID.value ('.','VARCHAR(20)')FROM @productIds.nodes('/Products/id')as ParamValues(ID) Which gives us the following three rows: 9 18 27
Polymorphism means having more than one form. Overloading and overriding are used to implement polymorphism. Polymorphism Examples Method Overloading Method Overriding There are two type of Polymorphism 1. Compile time polymorphism (Early binding or static binding) Examples: overloaded methods, overloaded operators and overridden methods that are called directly by using derived objects. 2. Run time polymorphism (Late binding or dynamic binding) Example: overridden methods that are called using base class object.
Get DataSource In C# as in most programming languages a variable must be declared before it can be used. In a LINQ query, the from clause comes first in order to introduce the data source (customers) and the range variable (cust). //QEmp is an IEnumerable var QEmp = from e in Emp select e; Filter Probably the most common query operation is to apply a filter in the form of a Boolean expression. The filter causes the query to return only those elements for which the expression is true. The result is produced by using the where clause. The filter in effect specifies which elements to exclude from the source sequence. var QEmp = from e in Emp where e.Country == "India" select e ----AND Condition---- where e.Country == "India" && e.Name == "Ashvin" ----OR Condition---- where e.Country == "India" || e.Name == "Ashvin" Ordering The orderby clause will cause the elements in the...
Back to Home 1) Separation of Concerns - Model: Model is associated with Views and a Controller (Bussiness Entity) - View: Views are the components that display on User Interface (UI) - Controller: Controller is an input control 2) Each component has one responsibility - SRP – Single Responsibility Principle - DRY – Don’t Repeat Yourself 3) More easily testable - TDD – Test-driven development 4) Helps with concurrent development - Performing tasks concurrently - One developer works on views - Another works on controllers 5) Replace any component of the system - Interface-based architecture 6) Almost anything can be replaced or extended - Model binders (request data to CLR objects) - Action/result filters (e.g. OnActionExecuting) - Custom action result types - View engine (Razor, WebForms, NHaml, Spark) - View helpers (HTML, AJAX, URL, etc.) 7) REST-like URLs - /accounts/details ...
i want create a Procedure that behave like this: declare @cnt int set @cnt =10 select top @cnt * from sw_user Where sw_user contains 20 records, and i want the variable to be the criteria of Top statement. so i can use this for a solution for this type of problem CREATE PROC Top10 @cnt int AS SET ROWCOUNT @cnt SELECT * FROM sw_user but some cases ROWCOUNT might not be work... so what, Note : This statement however is possible in SQL 2005, just add "()" in your variable like so: declare @cnt int set @cnt =10 select top (@cnt) * from sw_user
Comments