【发布时间】:2016-06-10 22:14:26
【问题描述】:
实际上,我正在尝试更新页面而不刷新整个页面,即部分页面更新。网页结构是
<%@ Page Title="Test Page" Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="WebApp.Test" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager runat="server"></asp:ScriptManager>
<asp:DropDownList AutoPostBack="true" ID="dropDownName" runat="server"></asp:DropDownList>
<asp:UpdatePanel ID="UpdatePanel" runat="server">
<ContentTemplate>
Last update: <%=DateTime.Now.ToString() %>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
现在我可以看到,当我的事件触发时,它会正确执行所有操作,例如读取内容、使用正确的更新信息更新页面上的控件以及将内容 webControls 添加到这样的占位符
void Contnt_Update(object sender)
{
PlaceHolder1.Controls.Add(newLabel);
}
但它只是没有更新“视图”(意味着我没有在网页上看到更新的信息),也没有更新“上次更新”的时间。 知道我在做什么错吗?任何帮助都将不胜感激,因为我在这上面花了很多时间,却没有得到任何帮助..
【问题讨论】:
标签: c# asp.net partial-page-refresh