-1
需要幫助顯示總和表的頁腳,我使用通用列表不可數據,當我谷歌的解決方案,我只能得到datatable指南,但沒有通用名單。顯示gridview頁腳
protected void FillRequestGrid()
{
if (Session["loggedUserID"] == null && Session["loggedRoleID"] == null)
{
Response.Redirect("Login.aspx");
}
else
{
int loggedUserID = Convert.ToInt32(Session["loggedUserID"]);
List<BOL.UserInfo> userslist = new UserInfos().List();
BOL.UserInfo loggeduser = userslist.Where(x => x.UserID == loggedUserID).FirstOrDefault();
List<BOL.HomeAnnouncement> train_L = new Homes().ATTENDANCE(loggeduser.SUBSIDIARY_CD, "7.00 am - 7.00 pm");
GrdUsers.DataSource = train_L;
GrdUsers.DataBind();
}
}
<asp:GridView ID="GrdUsers" runat="server" CssClass="table table-striped table-bordered table-hover" EmptyDataText="No Records Found" DataKeyNames="Description"
AllowPaging="true" AutoGenerateColumns="false" AutoGenerateDeleteButton="false" RowStyle-HorizontalAlign="Left" OnPageIndexChanging="GrdUsers_PageIndexChanging1"
HeaderStyle-HorizontalAlign="Center" GridLines="None" BorderWidth="2px" EditRowStyle-BorderColor="#000000" EmptyDataRowStyle-BorderStyle="Groove" PageSize="10"
Width="70%" RowStyle-CssClass="gradeX" AlternatingRowStyle-CssClass="gradeA">
<Columns>
<asp:TemplateField HeaderText="Area" HeaderStyle-BackColor="#0033cc" HeaderStyle-ForeColor="White" ItemStyle-Width="15%">
<ItemTemplate>
<label style="color: black; font-weight: 100"><%#DataBinder.Eval(Container.DataItem, "Description")%></label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total Employee" HeaderStyle-BackColor="#0033cc" HeaderStyle-ForeColor="White" ItemStyle-Width="10%">
<ItemTemplate>
<label style="color: black; font-weight: bold"><%#DataBinder.Eval(Container.DataItem, "a_1")%></label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Present" HeaderStyle-BackColor="#0033cc" HeaderStyle-ForeColor="White" ItemStyle-Width="7%">
<ItemTemplate>
<label style="color: black; font-weight: 100"><%#DataBinder.Eval(Container.DataItem, "a_2")%></label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Absent" HeaderStyle-BackColor="#0033cc" HeaderStyle-ForeColor="White" ItemStyle-Width="7%">
<ItemTemplate>
<label style="color: black; font-weight: 100"><%#DataBinder.Eval(Container.DataItem, "status")%></label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Percent of employee present(%)" HeaderStyle-BackColor="#0033cc" HeaderStyle-ForeColor="White" ItemStyle-Width="15%">
<ItemTemplate>
<label style="color: black; font-weight: 100"><%#DataBinder.Eval(Container.DataItem, "PURPOSE")%></label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle HorizontalAlign="Right" CssClass="pagination-ys" />
</asp:GridView>
期待這樣的輸出:
我的電流輸出數據是沒有頁腳。
它的壞主意,使用會話進行檢查,如果用戶登錄。 – Aristos
@Aristos爲什麼Session是那麼呢? – Imad
@Imad要爲用戶存儲一些數據,但需要憑證功能來檢查用戶是否已登錄。 – Aristos