【发布时间】:2021-05-06 17:06:03
【问题描述】:
我对 ASP.net Framework Webapps 环境还很陌生,遇到了一个问题。
如果我根据 C# 代码中的条件设置一个 Css 类,它就可以正常工作。我将应用程序发布到 IIS 的那一刻不再起作用。为了理智,我还尝试将应用程序发布为调试或发布模式,这没有任何区别。
在页面的page_load事件上加载数据,这里刷新updatepanel。
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upcontent">
<ContentTemplate>
<div class="jumbotron" style="padding: 5px; background-color: lightgrey; overflow: hidden">
<div class="card bg-secondary mb-3" style="max-width: 35rem; min-width: 35rem; float: left; overflow: hidden;">
<div class="card-header">Work Order Details</div>
<div class="card-body">
<asp:GridView ID="GVMain" margin-top="10px" runat="server" EmptyDataText="Record is empty" Width="100%" AutoGenerateColumns="true" ShowHeader="false" DataKeyNames="PropertyName" class="table table-hover" OnPageIndexChanging="GVMain_PageIndexChanging" OnRowDataBound="GVMain_RowDataBound" BorderStyle="NotSet" AllowPaging="true" PageSize="10">
<PagerSettings Mode="NumericFirstLast" />
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
代码背后:
protected void GVMain_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Check the XXXX column - if empty, the YYYY needs highlighting!
if (e.Row.Cells[1].Text == "Mon, 01/01/0001")
{
e.Row.Cells[1].CssClass = "text-warning"; // ...so highlight it
}
}
upcontent.Update();
}
请协助,请参阅下面的开发环境和部署环境之间的附加图片
Not Working when Depoyed on IIS Server
Not Working when Depoyed on IIS Server Inspect Panel
可以帮忙吗?需要注意的一点是,这是来自同一台 PC 上的同一浏览器。
【问题讨论】:
-
这似乎是一个区域问题。在您的生产服务器上,日期格式使用“-”而不是“/”。
标签: c# css asp.net bootstrap-4 webforms