[C#] 纯文本查看 复制代码
<div id="divTrackLog" style="margin:0 20px 0 20px;" ><br />
<span class="viewCompanyName2">系统处理记录</span>
<asp:GridView ID="gvComTrackLog" runat="server" cellpadding="0" cellspacing="0" AutoGenerateColumns="false" PageSize="10" AllowPaging="true">
<Columns>
<asp:BoundField DataField="TrackerName" HeaderText="处理人" ItemStyle-CssClass="txtcenter width100"/>
<asp:BoundField DataField="TrackTypeName" HeaderText="处理类别" ItemStyle-CssClass="txtcenter width100" ItemStyle-ForeColor="blue" />
<asp:BoundField DataField="Cotents" HeaderText="处理内容" ItemStyle-CssClass="break" />
<asp:BoundField DataField="TrackDateStr" HeaderText="处理时间" ItemStyle-CssClass="txtcenter width150" />
</Columns>
<EmptyDataTemplate>没有处理记录...</EmptyDataTemplate>
<PagerStyle CssClass="pager" HorizontalAlign="Right"/>
</asp:GridView>
</div>
[C#] 纯文本查看 复制代码
protected void GVCompany_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblReminder = e.Row.FindControl("lblReminder") as Label;
Label lblEndDate = e.Row.FindControl("lblEndDate") as Label;
DateTime endDate = Convert.ToDateTime(lblEndDate.Text);
int date = (Convert.ToDateTime(endDate.ToString("yyyy-MM-dd")) - Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"))).Days;
if (date >= 0 && date <= 1)
{
lblReminder.ForeColor = System.Drawing.Color.Red;
if (date == 0)
{
lblReminder.Text ="(今天到期)";
}
if (date == 1)
{
lblReminder.Text ="(明天到期)";
}
}
}
}
//分页方法添加方法
protected void GVCompany_Init(object sender, EventArgs e)
{
GVCompany.PageIndexChanging += new GridViewPageEventHandler(GVCompany_PageIndexChanging);
GVCompany.RowCommand += new GridViewCommandEventHandler(GVCompany_RowCommand);
}
//行内事件处理
public void GVCompany_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "del")
{
int ID = Convert.ToInt32(e.CommandArgument);
lineAdBLL.Delete(ID);
}
if (e.CommandName == "pause")
{
string type = e.CommandArgument.ToString().Split(',')[1];
int id = Convert.ToInt32(e.CommandArgument.ToString().Split(',')[0]);
Sys_LineAdBLL lineAdBll = new Sys_LineAdBLL();
if (type == "已暂停")
lineAdBll.UpdateStatueById(id, 0);
else
lineAdBll.UpdateStatueById(id, 3);
}
BindData();
}
//分页事件
public void GVCompany_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GVCompany.PageIndex = e.NewPageIndex;
BindData();
}