Microsoft
70-515 · Question #97
70-515 Question #97: Real Exam Question with Answer & Explanation
Sign in or unlock 70-515 to reveal the answer and full explanation for question #97. The question stem and answer options stay visible for context.
Question
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?
Options
- AImage img = (Image)Page.FindControl("img");
- BImage img = (Image)e.Row.FindControl("img");
- CImage img = (Image)gvModels.FindControl("img");
- DImage img = (Image)Page.Form.FindControl("img");
Unlock 70-515 to see the answer
You've previewed enough free 70-515 questions. Unlock 70-515 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.