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
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...
Abstract Class : The class which cannot be instantiated is known as an Abstract Class . So an object of it cannot be created. Hence it must be inherited. Can't be instantiated. Must be inherited. It may have Concrete Methods & Abstract Methods. An Abstract Class can have only Abstract Method. An Abstract Method must be overridden. public abstract class AbstractA { public abstract string AbstractProperty { get ; set ; } public abstract void AbstractFunction1(); public virtual void AbstractFunction2() { Console .WriteLine( "AbstractA : AbstractFunction2()" ); } public void AbstractFunct...
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, ...
Send Email using Gmail SMTP server-ASP.NET What is an SMTP server? (pronounced as separate letters) Short for S imple M ail T ransfer P rotocol, a protocol for sending e-mail messages between servers. Most e-mail systems that send mail over the Internet use SMTP to send messages from one server to another; the messages can then be retrieved with an e-mail client using either POP or IMAP. In addition, SMTP is generally used to send messages from a mail client to a mail server. This is why you need to specify both the POP or IMAP server and the SMTP server when you configure your e-mail application. Let's see one example in ASP.NET 2.0 (Web Application) In WebMailSend.aspx.cs file You have to import this namespace for MailMessage. using System.Net.Mail; protected void btnSend_Click( object sender, EventArgs e) { try { MailMessage mail = new MailMessage(); mail.IsBodyHtml = true ; mail.To.Add(txtEmail.Text); mail.Subject = txtSubject.Text; mail....
(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...
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
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