You create a Microsoft ASP.NET application by using the Microsoft .NET
Framework version 3.5.
You add a TextBox control named TextBox1.
You write the following code segment for validation. protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args) {
DateTime dt = String.IsNullOrEmpty(args.Value) ? DateTime.Now : Convert.ToDateTime(args.Value);
args.IsValid = (DateTime.Now - dt).Days < 10;
}
You need to validate the value of TextBox1.
Which code fragment should you add to the Web page?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment. (Line numbers are included for reference only.)
01 02 ID="rfValidator1" runat="server"
03 Display="Dynamic" ControlToValidate="TextBox1"
04
05 >
06
07
08
09 10 ID="ValidationSummary1" runat="server" />
You need to ensure that the error message displayed in the validation control is also displayed in the validation summary list.
What should you do?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment. onselectedindexchanged="DropDownList1_SelectedIndexChanged"> 1 2 3
You also add a MultiView control named MultiView1 to the Web page. MultiView1 has three child View controls.
You need to ensure that you can select the View controls by using the DropDownList1 DropDownList control.
Which code segment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create two user controls named UserCtrlA.ascx and UserCtrlB.ascx. The user controls postback to the server.
You create a new Web page that has the following ASPX code.
To dynamically create the user controls, you write the following code segment for the Web page.
public void LoadControls() {
if (ViewState["CtrlA"] != null) {
Control c;
if ((bool)ViewState["CtrlA"] == true) {
c = LoadControl("UserCtrlA.ascx"); }
else {
c = LoadControl("UserCtrlB.ascx");
}
ID = "Ctrl";
PlHolder.Controls.Add(c);
}
}
protected void Chk_CheckedChanged(object sender, EventArgs e) {
ViewState["CtrlA"] = Chk.Checked;
PlHolder.Controls.Clear();
LoadControls();
}
You need to ensure that the user control that is displayed meets the following requirements:
It is recreated during postback
It retains its state.
Which method should you add to the Web page?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
The application has a Web form file named MovieReviews.aspx.
The MovieReviews.aspx file connects to a LinqDataSource DataSource named LinqDataSource1 that has a primary key named MovieID.
The application has a DetailsView control named DetailsView1.
The MovieReviews.aspx file contains the following code fragment. (Line numbers are included for reference only.)
01 02
03 />
04
05 SortExpression="MovieID" />
06
07
08
09
10
You need to ensure that the users can insert and update content in the DetailsView1 control.
You also need to prevent duplication of the link button controls for the Edit and New operations.
Which code segment should you insert at line 02?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You add an XmlDataSource control named XmlDataSource1 to the Web page. XmlDataSource1 is bound to an
XML document with the following structure.
...
You also write the following code segment in the code-behind file of the Web page.
protected void BulletedList1_Click(object sender, BulletedListEventArgs e) {
//...
}
You need to add a BulletedList control named BulletedList1 to the Web page that is bound to XmlDataSource1.
Which code fragment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create the following controls:
A composite custom control named MyControl.
A templated custom control named OrderFormData.
You write the following code segment to override the method named CreateChildControls() in the MyControl class. (Line numbers are included for reference only.)
01 protected override void CreateChildControls() {
02 Controls.Clear();
03 OrderFormData oFData = new OrderFormData("OrderForm");
04
05 }
You need to add the OrderFormData control to the MyControl control.
Which code segment should you insert at line 04?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a
Web page that contains the following two XML fragments. (Line numbers are included for reference only.)
01
04 05 DataSourceID="SqlDataSource1"
06
07 >
08
09
10
11
12
The SqlDataSource1 object retrieves the data from a Microsoft SQL Server 2005 database table. The database table has a column named LineTotal.
You need to ensure that when the size of the LineTotal column value is greater than seven characters, the column is displayed in red color.
What should you do?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web page named Default.aspx in the root of the application. You add an ImageResources.resx resource file in the App_GlobalResources folder. The ImageResources.resx file contains a localized resource
named LogoImageUrl.
You need to retrieve the value of LogoImageUrl.
Which code segment should you use?
You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You create a Web page named enterName.aspx. The Web page contains a TextBox control named txtName.
The Web page cross posts to a page named displayName.aspx that contains a Label control named lblName.
You need to ensure that the lblName Label control displays the text that was entered in the txtName TextBox control.
Which code segment should you use?