Make sure that you add the Label and Button controls inside the UpdatePanel control.
더보기
Set the Text property of the Label to Panel created.
Double-click the Button control to add a handler for the button's Click event.
Add the following code to the Click handler, which sets the value of the label in the panel to the current time.
protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "Refreshed at " + DateTime.Now.ToString(); }
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Label1.Text = "Refreshed at " & _ DateTime.Now.ToString() End Sub
Save your changes and press CTRL+F5 to view the page in a browser.
Click the button.
Notice that the text in the panel changes to display the last time the panel's content was refreshed. This text is set in the button's Click event handler.
To see the full example in action, click the Run It button. The example is styled to better show the region of the page that the UpdatePanel represents.
The panel content changes every time that you click the button, but the whole page is not refreshed. By default, the ChildrenAsTriggers property of an UpdatePanel control is true. When this property is set to true, controls inside the panel participate in partial-page updates when any control in the panel causes a postback.
댓글 영역