我根本不是 ASP 编码员。只是想通过在现有的 AbleCommerce 页脚中添加动态版权日期来帮助朋友。我当前的代码不会导致错误,但也没有输出:
StoreFooter.ascx
<asp:Literal runat="server" ID="thisYear"></asp:Literal>
StoreFooter.ascx.cs
protected void Page_Load(object sender, EventArgs e)
{
AdminLink.Visible = AbleContext.Current.User.IsAdmin;
MobileLinkPanel.Visible = Request.Browser.IsMobileDevice;
MobileStoreLink.NavigateUrl = NavigationHelper.GetMobileStoreUrl("~/Default.aspx?FSIntent=false");
int thisYearInt = LocaleHelper.LocalNow.Year;
thisYear.Text = thisYearInt.ToString();
}
还尝试将日期设置为DateTime.Now.Year
. 谁能看到我错过了什么?如果我为 thisYear.Text 分配一个字符串,我也不会得到任何输出。