单项选择题
You are implementing an ASP.NET page. Client-side script requires data. Your application includes a class named Person with a Name property of type string. The code-behind file of the page includes the following code segment.
You need to use the JavaScriptSerializer class to serialize only the Name property of each item in the people list. Which code segment should you use?()
A.JsonValue = json.Serialize(people.Select(p => p.Name));
B.var names = from person in people select person; JsonValue = "{" + json.Serialize(names) + "}";
C.JsonValue = json.Serialize(people.SelectMany( p =>Name.AsEnumerable()));
D.var names = from person in people select person; JsonValue = json.Serialize(names);
相关考题
-
单项选择题
You are implementing an ASP.NET page. You add and configure the following ObjectDataSource. The page will be called with a query string field named pid. You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method. What should you do? ()
A.Replace the asp:QueryStringParameter with the following declaration.
B.Replace the asp:QueryStringParameter with the following declaration.
C.Add the following event handler to the Selecting event of the ObjectDataSource control.
D.Add the following code segment to the page’s code-behind. -
单项选择题
YouareimplementinganASP.NETpage.ThepageincludesamethodnamedGetCustomerOrderDataSetthatreturnsaDataSet.TheDataSetincludesaDataTablenamedCustomerDetailsTableandaDataTablenamedOrderDetailsTable.YouneedtodisplaythedatainOrderDetailsTableinaDetailsViewcontrolnameddtlView.Whichcodesegmentshouldyouuse?()
A. dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataMember = "OrderDetailsTable"; dtlView.DataBind();
B.dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataSourceID = "OrderDetailsTable"; dtlView.DataBind();
C.dtlView.DataSource = GetCustomerOrderDataSet(); dtlView.DataKeyNames = new string [] { "OrderDetailsTable"}; dtlView.DataBind();
D.DataSet dataSet = GetCustomerOrderDataSet(); dtlView.DataSource = new DataTable("dataSet", "OrderDetailsTable"); dtlView.DataBind(); -
单项选择题
YoudeployanASP.NETapplicationtoanIISserver.Youneedtologhealth-monitoringeventswithseverityleveloferrortotheWindowsapplicationeventlog.Whatshouldyoudo?()
A.Run the aspnet_regiis.exe command.
B.Set the Treat warnings as errors option to All in the project properties and recompile.
C.Add the following rule to thesection of the web.config file.
D.Add the following rule to thesection of the web.config file.
