Validation Control and Web page navigation - Placement questions

Validation Control and Web page navigation - Placement questions


Q.1 ASP.NET validation controls works (handle validation) at

A) Client side only.
B) Server side only.
C) Both client side and server side.
D) None of the above.
View Answer / Hide Answer

ANSWER: C

Explanation:

ASP.NET validation controls can be attached to user input controls to handle validation on both the server and the client. Client-side validation improves performance by checking the input data at the browser before sending to the server. Clint side validation is not so much secure. It can be easily hacked by hackers. Server-side validation is more secure way of validating the data that is posted back to the server.




Q.2 Client-side validation is turned on by default. If you want that particular validation control should not validate at client side, what will you do?

A) Set the EnableClientScript property to false.
B) Set the validate property to false.
C) Set the EnableClientScript property to true.
D Set the Page.Isvalid property to false.
View Answer / Hide Answer

ANSWER: A




Q.3 Suppose that you are developing a website for company name CareerRide. You have used validation control on web page. If the input data is wrong and error occurs, you want that focus should be on that particular control until it has valid data. What will you do?

A) Focus=true
B) set SetFocusOnError property to true.
C) ErrorMessage=true.
D) None of the above.
View Answer / Hide Answer

ANSWER: B




Q.4 There is a button on page name cancel and it should bypass validation when cancel button is clicked. What will you do?

A) set CausesValidation = false.
B) set RemoveValidation=true
C) set cancel=true
D) None of the above.
View Answer / Hide Answer

ANSWER: A




Q.5 Which is the mandatory property for all validation controls?

A) ControlToValidate
B) Message
C) EnableClientScript
D EnableServerScript
View Answer / Hide Answer

ANSWER: A




Q.6 Which validation control in ASP.NET can be used to determine if data that is entered into a TextBox control is of type Currency?

A) ValidationSummary
B) CompareValidator
C) RequiredFieldValidator
D) None of the above.
View Answer / Hide Answer

ANSWER: B

Explanation:

You can use the CompareValidator control to do a data type check. Set its operator property to DataTypeCheck and its Type property to Currency.




Q.7 CompareValidator control can be used for performing which task?

A) To perform a data type check.
B) To compare the value entered into a form field against a fixed value.
C) To compare the value of one form field against another.
D) All of the above.
View Answer / Hide Answer

ANSWER: D




Q.8 If you want to validate the email addresses, Social Security numbers, phone numbers, and dates types of data which validation control will be used?

A) RegularExpressionValidator
B) CompareValidator
C) RequiredFieldValidator
D) None of the above.
View Answer / Hide Answer

ANSWER: A




Q.9 You are developing a Web page that contains many validated controls. You want to provide a detailed message for each validation error, but the page doesn’t have sufficient space to provide the detailed message next to each control. What can you do to indicate an error at the control and list the detailed error messages at the top of the Web page?

A)
- Set the Text property of the validator control to the detailed message.
- Set the ErrorMessage property to an asterisk (*).
- Place a ValidationSummary control at the top of the Web page.
B)
- Set the ErrorMessage property of the validator control to the detailed message.
- Set the Text property to an asterisk (*).
- Place a ValidationSummary control at the top of the Web page.
C)
- Set the ToolTip property of the validator control to the detailed message.
- Set the ErrorMessage property to an asterisk (*).
- Place a ValidationSummary control at the top of the Web page.
D) None of the above
View Answer / Hide Answer

ANSWER: B




Q.10 Match the following List 1 to List 2

List 1 -----------------------------List 2

a. Client-side navigation-----------i Server.Transfer
b. Cross-page posting---------------ii. Response.Redirect
c. Client-side browser redirects----iii. PostBackUrl
d. Server-side transfer-------------iv. HyperLink

Codes:

A) a-iv, b-iii, c-ii, d-i
B) a-ii, b-iv, c-i, d-iii
C) a-ii, b-i, c-iii, d-iv
D) a-ii, b-iv, c-iii, d-i
View Answer / Hide Answer

ANSWER: A

Description:

1.Client-side navigation
HyperLink control is used Client-side navigation for client site navigation. NavigateUrl property is used for jump to the desired page. The HyperLink control generates an HTML anchor tag,<a>.

Example:

HyperLink Control: Source
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Welcome.aspx">Goto CareerRide</asp:HyperLink>
HyperLink Control: Rendered HTML
<a id="HyperLink1" href=" Welcome.aspx">Goto CareerRide </a>

2.Cross-Page Posting

Button control has PostBackUrl property. Set this property to the designated Web page to which the processing should post back. The page receives the posted data from the first page for processing. You can access the controls found in the previous page by using the FindControl method of the PreviousPage property.
Example:
Suppose a web page called CollectData.aspx contains a TextBox control called TextBox1 and a Button control that has its PostBackUrl set to “~/ProcessingPage.aspx”. ProcessingPage.aspx is the second page that contains a Label control called Label1. Code for access the Textbox control data in ProcessingPage.aspx page is as follows.
Label1.Text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;

3. Client-Side Browser Redirect

Response.Redirect method is used to instruct the browser to initiate a request for another Web page.
Example:
Response.Redirect("NextPage.aspx");

4. Server-Side Transfer

Server.Transfer method is used for side transfer.
Server.Transfer("NextPage.aspx");



Post your comment