Sie sind auf Seite 1von 3

Tutorial 04 ASP.

.NET Web forms and Controls Answer following question and submit your work before 9:00 PM March 5, 2012 Q1: What are the two standard HTTP methods of sending data to a Web host? Which does ASP.NET use as its default? They are GET and POST methods. "GET" is basically for just getting (retrieving) data whereas "POST"may involve anything, like storing or updating data, ASP.NET uses POST as its default method. Q2: You set up an event handler to be called when the contents of a TextBox change. If the contents are changed, when is the event handler code executed? TextChanged() is the envent handler used in this case. TextChanged is fired when the control loses focus (click the mouse out of the text box, sometimes, press tab to move from box to box). Q3: You have a form containing a text box field that is used to input a phone number. Which control would you use to ensure that the phone number includes an area code? It is RegularExpressionValidator. The RegularExpressionValidator control is used to determine whether the value of an input control matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on. Q4: Which directive must a Web page include to use a custom control on the page? a. @Page b. @Import

c. @Register d. @Assembly Q5: True or False: A Web application requires at least one web.config file in its directory tree. True Q6: What are ASP and ASP.NET? Clarify the difference of these concepts. ASP stands for Active Server Pages, and it is Microsoft's implementation of server-side scripting. ASP.NET, the next version of ASP, is a programming framework used to create enterpriseclass Web Applications. ASP:

Is not truly Object Oriented; it uses more of a top-down programming style, where code execution begins at the top and executes down to the end. You can use functions, subroutines, classes and other objects, but it isn't OO. You are limited to using either the Visual Basic or JavaScript scripting languages. All variables are global of type variant, which like its counterpart in VB6, is an object that can be any object type, from a string to an integer to a Word application object.

ASP.NET:

Is Object Oriented, uses the event-driven model, where all your code executes in response to an event, like a mouseclick, or a Page Load, etc. You can use many different languages to write your code: Visual Basic, C##, J##, Ruby, even Visual RPG. All code is compiled to use the same Common Language Runtime (CLR) that resides in the .NET Framework. Variables are strongly typed, and the same scoping rules that apply in any recent, major programming language.

Q7: In which event are the controls fully Loaded?

Its Page Load event. The Page_Load event is one of many events that ASP.NET understands. The Page_Load event is triggered when a page loads, and ASP.NET will automatically call the subroutine Page_Load, and execute the code inside it. Q8: What is ViewState? View state, in a nutshell, is the technique used by an ASP.NET Web page to persist changes to the state of a Web Form across postbacks. View state is a repository in an ASP.NET page that can store values that have to be retained during postback. The page framework uses view state to persist control settings between postbacks. User can use view state in your own applications to do the following:
Keep

values between postbacks without storing them in session state or in a user profile. Store the values of page or control properties that you define. Create a custom view state provider that lets you store view state information in a SQL Server database or in another data store.

Q9: Differentiate between client-side and server-side validations in Web pages?


In client-side, validation occurs in client machine and through browser. In server-side, validation occurs in server and the result is pushed back to the browser.

Das könnte Ihnen auch gefallen