You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridVie
You are implementing an ASP.NET application that uses data-bound GridView controls in multiple
pages. You add JavaScript code to periodically update specific types of data items in these GridView
controls. You need to ensure that the JavaScript code can locate the HTML elements created for
each row in these GridView controls, without needing to be changed if the controls are moved from
one page to another. What should you do?
You need to ensure that all data that is submitted passes validation before the data is saved in a database
You are developing an ASP.NET Web page that contains input controls, validation controls, and a
button named btnSubmit. The page has the following code-behind. (Line numbers are included for
reference only.)
01 public partial class _Default : System.Web.UI.Page
02 {
03 protected void SaveToDatabase()
04 {
05
06 }
07
08 protected void btnSubmit_Click(object sender,
EventArgs e)
09 {
10
11 }
12 }
You need to ensure that all data that is submitted passes validation before the data is saved in a
database. What should you do?
You need to display the value of the master page’s Region property in lblRegion
You are creating an ASP.NET Web site. The site has a master page named Custom.master. The
code-behind file for Custom.master contains the following code segment.
public partial class CustomMaster : MasterPage
{
public string Region
{
get; set;
}
protected void Page_Load(object sender, EventArgs e)
{}}
You create a new ASP.NET page and specify Custom.master as its master page. You add a Label
control named lblRegion to the new page. You need to display the value of the master page’s Region
property in lblRegion. What should you do?
Which declaration should you use?
You create a Web page that contains the following code. (Line numbers are included for reference
only.)
01 <script>
02 function changeColor(c) {
03 document.getElementById(“message”).style.color=c;
04 }
05 </script>
06
07 <p id=”message”>Welcome!</p>
08 <ul id=”color”>
09 <li>Black</li>
10 <li>Red</li>
11 </ul>
You need to ensure that when the user clicks an item in the list, the text color of the Welcome!
message will change. Which declaration should you use?
Which code segment should you use?
Which code segment should you use?
You create a Web page that contains the following div.
<div id=”target”>
</div>
You have a JavaScript array named imageurls that contains a list of image URLs. You need to write a
JavaScript function that will insert images from the URLs into target. Which code segment should
you use?
What should you set the ClientIDMode property of the DropDownList to?
You are developing an ASP.NET Web page. You add a data-bound GridView control. The GridView
contains a TemplateField that includes a DropDownList. You set the GridViews ClientIDMode
property to Static, and you set the ClientIDRowSuffix property to ProductID. You need to be able to
reference individual DropDownList controls from client-side script by using the ProductID. What
should you set the ClientIDMode property of the DropDownList to?
Which code segment should you use?
A Web service returns a list of system users in the following format.
<?xml version=”1.0″ ?>
<users>
<user id=”first”>
<name>Name of first user</name>
<email>first@contoso.com</email>
</user>
<user id=”second”>
<name>Name of second user</name>
<email>second @contoso.com</email>
</user>
</users>
You need to populate a drop-down menu with the IDs and names of the users from the Web service,
in the order provided by the service. Which code segment should you use?
You need to configure the panels to meet the requirements
You are implementing an ASP.NET AJAX page. You add two UpdatePanel controls named pnlA and
pnlB. pnlA contains an UpdatePanel control named pnlAInner in its content template. You have the
following requirements. Update panels pnlA and pnlB must refresh their content only when controls
that they contain cause a postback. Update panel pnlAInner must refresh its content when controls
in either pnlA or pnlB or pnlAInner cause a postback. You need to configure the panels to meet the
requirements. What should you do?
Which code segment should you add at line 06?
You are developing an ASP.NET Web page.
The page contains the following markup.
<asp:GridView ID=”gvModels” runat=”server”
onrowdatabound=”gvModels_RowDataBound”
AutoGenerateColumns=”false”>
<Columns>
<asp:BoundField DataField=”Name” HeaderText=”Model” />
<asp:TemplateField>
<ItemTemplate>
<asp:Image ID=”img” runat=”server” />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
The pages code-behind file includes the following code segment. (Line numbers are included for
reference only.)
01 protected void gvModels_RowDataBound(object sender,
GridViewRowEventArgs e)
02 {
03 if (e.Row.RowType == DataControlRowType.DataRow)
04 {
05 CarModel cm = (CarModel)e.Row.DataItem;
06
07 img.ImageUrl = String.Format(“images/{0}.jpg”,
cm.ID);
08
09 }
10 }
You need to get a reference to the Image named img. Which code segment should you add at line
06?