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...
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 ...
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
(Works in both SQL Server 7.0 and 2000) Declare @OrderList varchar (500) set @OrderList = 'Order1,Order2,,Order3,,,Order4,Order5,' ; drop TABLE #TempList CREATE TABLE #TempList ( OrderID varchar (20) ) DECLARE @OrderID varchar (10), @Pos int SET @OrderList = LTRIM(RTRIM(@OrderList))+ ',' SET @Pos = CHARINDEX( ',' , @OrderList, 1) IF REPLACE(@OrderList, ',' , '' ) <> '' BEGIN WHILE @Pos > 0 BEGIN SET @OrderID = LTRIM(RTRIM( LEFT (@OrderList, @Pos - 1))) IF @OrderID <> '' BEGIN INSERT INTO #TempList (OrderID) VALUES (@OrderID) END SET @OrderList = RIGHT (@OrderList, LEN(@OrderList) - @Pos) SET @Pos = CHARINDEX( ',' , @OrderList, 1) END END SELECT * FROM #TempList t +-+-+-+-+-+ OUTPUT +-+-+-+-+-+ OrderID -------- -- Order1 Order2 Order3 Order4 Order5
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...
SOLID Principles are coding standards that all developers should have a clear concept for developing software in a proper way to avoid a bad design. S - Single Responsibility Principle (SRP): A class should have one, and only one, a reason to change In Single Responsibility Principle Each class and module should focus on a single task at a time Everything in the class should be related to that single purpose There can be many members in the class as long as they related to the single responsibility With SRP, classes become smaller and cleaner Code is less fragile Here UserAccount class created which have below operations like, Login, Register, LogError and Send Mail. According to SRP, ideally, LogError and SendEmail are should not be part of UserAccount operations. public class UserAccount { public bool Login( string username, ...
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
I was facing some issue to update excel cell which was depended on some formula, I need to change 'Comparison_Rate_Calculator' by Programming and need to read Calculated value by formula '=+HLOOKUP(C3,Workings!$D$1:$AJ$2,2,FALSE)' over 'Comparison_Rate_Calculator_Values' column. I didn't get calculated value even i was able to change 'Comparison_Rate_Calculator' column's value. So I got solutions by refreshing Excel WorkSheet and Here is the Solutions. File: Web.Config < connectionstrings > < add name = " xls " connectionstring = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\AshvinWorkspace\POCs\ReadExcelSheet\ReadExcelSheet\Files\HLComparisonRateCalculator.xls;Extended Properties=Excel 8.0 " > </ add > </ connectionstrings > File: Default.aspx.cs public partial class _Default : System.Web.UI. Page { protected void ...
Comments