Question:You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You create a Web page named Default.aspx. You write following code fragment in the Web page. <%@ Page Language="C#" AutoEventWireup="true" Inherits=" _Default"%> ...

<asp:Form id="Form1" runat="server">

<asp:Label id="lblErrors" runat="server" />

<asp:Panel id="pnlControls" runat="server" />

</asp:Form>

The application has a user control named Weather.ascx. You add a user control dynamically in the Panel control. You need to ensure that if any exception results from the Weather.ascx user control, the exception message is displayed in the lblErrors Label control. Which code segment should you use in the Page_Error event handler of the Weather.ascx user control?

 

A 

((_Default)this.Page).lblError.Text =

Server.GetLastError().Message;

 

B 

((_Default)this.Parent).lblError.Text =

Server.GetLastError().Message;

 

C 

((Label)this.FindControl(lblError )).Text =

Server.GetLastError().Message;

 

D 

((Label)this.Parent.FindControl(lblError )).Text =

Server.GetLastError().Message;

 

+ Answer
+ Report
Total Preview: 3993

Copyright © 2024. Powered by Intellect Software Ltd