PrepAway - Latest Free Exam Questions & Answers

You need to ensure that the JavaScript for each of these controls that is used in an ASP.NET page…

You are implementing custom ASP.NET server controls.
You have a base class named RotaryGaugeControl and two subclasses named CompassGaugeControl and
SpeedGaugeControl.
Each control requires its own client JavaScript code in order to function properly.
The JavaScript includes functions that are used to create the proper HTML elements for the control.
You need to ensure that the JavaScript for each of these controls that is used in an ASP.NET page is included
in the generated HTML page only once, even if the ASP.NET page uses multiple instances of the given control.
What should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
Place the JavaScript in a file named controls.js and add the following code line to the Page_Load method of
each control.
Page.ClientScript.RegisterClientScriptInclude(this.GetType(), “script”,
“controls.js”);

B.
Add the following code line to the Page_Load method of each control, where strJavascript contains the
JavaScript code for the control.
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), “script”,
strJavascript);

C.
Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of
the control class and strJavascript contains the JavaScript code for the control.
Page.ClientScript.RegisterStartupScript(typeof(CLASSNAME), “script”,
strJavascript);

D.
Add the following code line to the Page_Load method of each control, where CLASSNAME is the name of
the control class and strJavascript contains the JavaScript code for the control.
Page.ClientScript.RegisterClientScriptBlock(typeof(CLASSNAME), “script”,
strJavascript);


Leave a Reply