070-515試験無料問題集「Microsoft TS: Web Applications Development with Microsoft .NET Framework 4 認定」

You are developing an ASP.NET Web page. You add the following markup to the page.
<asp:FileUpload id="FileUpload1" runat="server" />
<asp:Button id="btnUpload" Text="Upload selected file"
OnClick="btnUpload_Click" runat="server" />
<asp:Label id="lblFeedback" runat="server" />
You add the following code segment to the code-behind. (Line numbers are included for reference only.)
01 protected void btnUpload_Click(object sender, EventArgs e)
02 {
03 if (...)
04 {
05 string saveName = Path.Combine(@"c:\uploadedfiles\",
FileUpload1.FileName);
06
07 lblFeedback.Text = "File successfully uploaded.";
08 }
09 else
10 {
11 lblFeedback.Text = "File upload failed.";
12 }
13 }
You need to save the uploaded file and display a message to the user that indicates that the upload either
succeeded or failed.
Which two actions should you perform? (Each correct answer presents part of the solution. Choose two.)

You are implementing an ASP.NET page that will retrieve large sets of data from a data source.
You add a ListView control and a DataPager control to the page.
You need to ensure that the data can be viewed one page at a time.
What should you do?

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 create an ASP.NET MVC 2 Web application that contains the following controller class.
public class ProductController : Controller { static List<Product> products = new List<Product>();
public ActionResult Index() { return View(); } }
In the Views folder of your application, you add a view page named Index.aspx that includes the following @ Page directive.
<%@ Page Inherits="System.Web.Mvc.ViewPage" %>
You test the application with a browser.
You receive the following error message when the Index method is invoked: "The view 'Index' or its master
was not found."
You need to resolve the error so that the new view is displayed when the Index method is invoked.
What should you do?

You are implementing an ASP.NET application. You add the following code segment.
public List<Person> GetNonSecretUsers()
{ string[] secretUsers = {"@secretUser", "@admin", "@root"}; List<Person> allpeople = GetAllPeople(); ...
}
You need to add code to return a list of all Person objects except those with a UserId that is contained in the secretUsers list.
The resulting list must not contain duplicates. Which code segment should you use?

You are implementing an ASP.NET MVC 2 Web application that contains the following class.
public class DepartmentController : Controller { static List<Department> departments = new List<Department>();
public ActionResult Index()
{
return View(departments);
}
public ActionResult Details(int id)
{
return View(departments.Find(x => x.ID==id));
}
public ActionResult ListEmployees(Department d)
{
List<Employee> employees = GetEmployees(d);
return View(employees);
} }
You create a strongly typed view that displays details for a Department instance.
You want the view to also include a listing of department employees.
You need to write a code segment that will call the ListEmployees action method and output the results in
place.
Which code segment should you use?

You are implementing an ASP.NET page in an e-commerce application.
Code in a btnAddToCart_Click event handler adds a product to the shopping cart.
The page should check the status of the shopping cart and always show a cart icon when one or more
items are in the shopping cart.
The page should hide the icon when the shopping cart has no items.
You need to add an event handler to implement this requirement.
Which event handler should you add?

You are implementing a read-only page that includes the following controls.
<asp:Button ID="btnRefresh" runat="server" Text="Button" /> <asp:GridView ID="gvCustomers" runat="server" EnableViewState="False" OnDataBinding="gvCustomers_DataBinding"></asp:GridView>
You disable view state to improve performance.
You need to ensure that the page is updated to display the latest data when the user clicks the refresh
button.
Which code segment should you use?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
You are planning to deploy the ASP.NET Web application to a production server by publishing the Web
application in Release configuration.
You must ensure that the connection string value in the Web.config file is updated to the connection string
value of the production server during publishing. What will you do?

You work as an ASP.NET Web Application Developer for SomeCompany.
The company uses Visual Studio .NET 2010 as its application development platform.
You create an ASP.NET Web application using .NET Framework 4.0.
The application has an ASP.NET page.
The page contains a method named GetCustomerOrderData that returns a DataSet.
GetCustomerOrderData contains two DataTable objects named CustomerDetails and OrderDetails,
respectively.
You are required to display the data in OrderDetails in a DetailsView named ViewDetail.
Choose the appropriate steps in the correct order to accomplish this.
Build List and Reorder:
正解: