PrepAway - Latest Free Exam Questions & Answers

Which two actions should you perform?

You create a custom server control named Task that contains the following code segment. (Line
numbers are included for reference only.)
01Namespace DevControls
03 Public Class Task
04 Inherits WebControl
06 <ComponentModel.DefaultValue(“”)>
07 Public Property Title As String
09 Protected Overrides Sub RenderContents(
10 ByVal output As HtmlTextWriter)
12 output.Write(Title)

13 End Sub
15 End Class
17 End Namespace
You need to ensure that adding a Task control from the Toolbox creates markup in the following
format.
<Dev:Task ID=”Task1″ runat=”server” Title=”New Task” />
Which two actions should you perform? (Each correct answer presents part of the solution. Choose
two.)

PrepAway - Latest Free Exam Questions & Answers

A.
Add the following code segment to the project’s AssemblyInfo.vb file.
<Assembly: TagPrefix(“DevControls”, “Dev”)>

B.
Replace line 06 with the following code segment.
<ComponentModel.DefaultValue(“New Task”)>

C.
Insert the following code segment immediately before line 03.
<ToolboxData(“<{0}:Task runat=””server”” Title=””New Task”” />”)>

D.
Replace line 12 with the following code segment.
output.Write(“<Dev:Task runat=””server”” Title=””New Task”” />”)

Explanation:
CHAPTER 7 Creating Custom Web Controls
Lesson 2: Creating Custom Web Server Controls
Controlling the Markup Generated for Your Custom Web Server Control (page 369)


Leave a Reply