Question: You are in the process of creating an ASP.NET application using .NET Framework 3.5. The application is designed for mobile devices and contains a mobile Web form. The Web form has the following code:
<mobile:ObjectList ID="OlCrtl" OnItemCommand="OlCrtl_ItemCommand" Runat="server"> <Command Name="cmdShowData" Text="Data" /> <Command Name="cmdClear" Text="Clear" /> </mobile:ObjectList>
You then create an event handler named OlCrtl_ItemComman
- You should consider writing the following code segment:
Public Sub OlCrtl_ItemCommand(ByVal sender As Object, _
ByVal e As ObjectListCommandEventArgs)
Dim olCmd As ObjectListCommand = TryCast(sender, ObjectListCommand)
If olCmd.Name = “ShowData” Then
End If
End Sub - You should consider writing the following code segment:
Public Sub OlCrtl_ItemCommand(ByVal sender As Object, _
ByVal e As ObjectListCommandEventArgs)
Dim olCmd As ObjectListCommand = TryCast(e.CommandSource, ObjectListCommand)
If olCmd.Name = “ShowData” Then
End If
End Sub - You should consider writing the following code segment:
Public Sub OlCrtl_ItemCommand(ByVal sender As Object, _
ByVal e As ObjectListCommandEventArgs)
If e.CommandName = “ShowData” Then
End If
End Sub - You should consider writing the following code segment:
Public Sub OlCrtl_ItemCommand(ByVal sender As Object, _
ByVal e As ObjectListCommandEventArgs)
If e.CommandArgument.ToString() = “ShowData” Then
End If
End Sub
Correct Answer: 3
Question: You are the senior technician at Company.com. You have been instructed to create an ASP.NET AJAX enabled application that uses Microsoft .NET Framework 3.5. Your application contains a Web form. In order to handle exception from asynchronous postbacks you decide to write the client script code fragment below. (The line numbers is included for reference purposes)
01 <script type=”text/javascript”>
02 function pageLoad()
03 {
04 var getErr = Sys.WebForms.PageRequestManager.getInstance();
05
06 }
07
08 function errHandle(sender, args)
09 {
10
11 }
12 </script>
You receive an instruction from the senior developer to ensure that the application makes use of the errHandle function to display an error message in a Label control named lbl1 instead of in message box or Javascript error. How can this be accomplished?
- This can be accomplished by adding the getErr.add_pageLoaded(errHandle) code segment at line 05. Then the code segment below should be added at line 10.
if (args.get_err() != null) {
$get(‘lbl1’).innerHTML = args.get_err().message;
args.set_errHandle(true);
} - This can be accomplished by adding the getErr.add_endRequest(errHandle) code segment at line 05. Then the code segment below should be added at line 10.
if (args.get_err() != null) {
$get(‘lbl1’).innerHTML = args.get_err().message;
} - This can be accomplished by adding the getErr.add_pageLoaded(errHandle) code segment at line 05. Then the code segment below should be added at line 10.
if (args.get_err() != null) {
$get(‘lbl1’).innerHTML = args.get_err().message;
} - This can be accomplished by adding the getErr.add_endRequest(errHandle) code segment at line 05. Then the code segment below should be added at line 10.
if (args.get_err() != null) {
$get(‘lbl1’).innerHTML = args.get_err().message;
args.set_errHandle(true);
}
Correct Answer: 4
Question: You work as a Web Developer at Company.com. You make use of Microsoft ASP.NET 3.5 in order to create a Web application. The application contains a generic handler file named CKHandler.ashx. The code below is added to the generic handler file (The line numbers are included for reference purposes):
01 public class CKHandler : IHttpHandler
02 {
03 public void ProcessRequest(HttpContext context)
04 {
05 Bitmap validationBitmap = (Bitmap)Session[“ValidationImage”];
06
07 }
08 public bool IsReusable
09 {
10 get
11 {
12 return false;
13 }
14 }
15 }
Management wants you to render the validationBitmap instance as a JPEG image as soon as the CKHandler.ashx is requeste
- You should add the code segment:
context.Response.ContentType = “image/jpeg”;
context.Response.Write(validationBitmap); - You should add the code segment:
context.Response.ContentType = “image/jpeg”;
validationBitmap.Save(context.Request.InputStream, ImageFormat.Jpeg); - You should add the code segment:
context.Response.ContentType = “image/jpeg”;
context.Response.Write(validationBitmap.RawFormat); - You should add the code segment:
context.Response.ContentType = “image/jpeg”;
validationBitmap.Save(context.Response.OutputStream, ImageFormat.Jpeg);
Correct Answer: 4