Question:You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You write the following code fragment:
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="updateLabels" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" />
<asp:Label ID="Label2" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
onclick="btnSubmit_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:Label id="Label3" runat="server" />
You need to ensure that when you click the btnSubmit Button control, each Label control value is asynchronously
updatable.
Which code segment should you use?
A protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
Label3.Text = "Label3 updated value";
}
B protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterDataItem(Label3, "Label3 updated value");
}
C protected void btnSubmit_Click(object sender, EventArgs e) {
ScriptManager1.RegisterDataItem(Label1, "Label1 updated value");
ScriptManager1.RegisterDataItem(Label2, "Label2 updated value");
Label3.Text = "Label3 updated value";
}
D protected void btnSubmit_Click(object sender, EventArgs e) {
Label1.Text = "Label1 updated value";
Label2.Text = "Label2 updated value";
ScriptManager1.RegisterAsyncPostBackControl(Label3);
Label3.Text = "Label3 updated value";
}