About Me

My photo
Northglenn, Colorado, United States
I'm primarily a BI Developer on the Microsoft stack. I do sometimes touch upon other Microsoft stacks ( web development, application development, and sql server development).

Wednesday, September 20, 2006

MS ASP.Net Assessment Questions: Setting cursor inside textbox on page loading.

You are developing a Web Form. The Web Form allows users to insert personal information.
You need to set the cursor inside the given name text box when the Web Form is first displayed.
What should you do?

A) Call the SetFocus method of the Page inside the text box control's Init event.
B) Set the text box control's TabIndex property to 0.
C) Call the Focus method of the text box control inside the page load event.
D) Set the text box control's Enabled attribute to True inside the form's source view.

My answer would be C, since it just makes sense to set focus to the control during the page_load event.

A is wrong (IMO): because SetFocus is not a defined method and the Page_Init only initializes the page when it is first called. The Page_Load event is then called once the request has been processed, and all of the controls are updated.

B is wrong because the TabIndex only tells what order of the controls on the page are sequentially access when the tab button is pressed.

D is wrong because setting a control to enabled only allows the user to enter information into that control.

No comments: