0
ASP.NET 사용자 정의 컨트롤에 여러 열의 DataGrid가 있습니다. 꼬리말의 열은 하나의 셀로 병합하고 싶습니다. 어떻게해야합니까? 코드 숨김, 부트 스트랩 4 베타 클래스에 대해 C#을 사용하여 뷰포트 너비가 변경되면서 열을 자동으로 숨기고, 일부 기호/아이콘에 대해서는 Font-Awesome을, 아래에는 ASCG 태그 안에 DataGrid가 있습니다. 현재는 바닥 글 행을 모두 하나의 셀로 병합하려는 경우를 제외하고는 모두 작동합니다. 결국, 첫 번째 열의 FooterTemplate에있는 항목은 이미 병합 된 바닥 글 셀에 걸쳐 펼쳐져 있어야합니다. 왜냐하면 이미 스타일링을 준비했기 때문입니다 (다른 모든 빈 바닥 글 셀이 첫 번째 바닥 글에 병합된다는 가정입니다. 첫 번째 바닥 글 셀의 내용이 유지됨).응답하는 부트 스트랩 된 DataGrid에서 모든 바닥 글 셀을 병합하는 방법은 무엇입니까?
protected void dgEggGradeDetails_ItemCreated(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
int newcolspan = 1;
int totalColumns = e.Item.Cells.Count - 1;
for (int i = totalColumns; i >= 1; i--)
{
if (e.Item.Cells[i].Visible)
{
e.Item.Cells.RemoveAt(i);
newcolspan++;
}
}
e.Item.Cells[0].ColumnSpan = newcolspan;
}
}
: 코드 숨김에서
<div class="col-lg-12 ">
<div class="table-responsive">
<asp:datagrid id="dgEggGradeDetails" UseAccessibleHeader="True" AutoGenerateColumns="False" CssClass="table table-striped table-bordered table-hover" ShowHeader="True" ShowFooter="True" runat="server" DataKeyField="EggID" CellPadding="0" GridLines="None" AllowSorting="True" OnSortCommand="dgEggGradeDetails_SortCommand" OnItemCreated="dgEggGradeDetails_ItemCreated">
<FooterStyle CssClass="">
</FooterStyle>
<Columns>
<asp:TemplateColumn HeaderText="Egg ID" SortExpression="EggID" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblEggID" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggID") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<div id="dvHidePickledOrDeviled" runat="server">
<div style="text-align: left; float: left; width: 80%; height: 100%;">
<asp:Label ID="lblHideFooter" runat="server" CssClass="" Visible="True">Hide All Eggs (Deviled, Pickled)</asp:Label>
</div>
<div style="text-align: right;">
<asp:LinkButton ID="btnHidePickledOrDeviled" runat="server" OnClick="ShowOrHidePickledOrDeviled" CssClass="" Visible="True" CommandName="HidePickledOrDeviled">
<i id="iHidePickledOrDeviled" class="fa fa-minus-square-o" style="font-size: 40px;" title="Hide Eggs with 'Deviled' and 'Pickled' grades"></i>
</asp:LinkButton>
</div>
</div>
<div id="dvShowPickledOrDeviled" runat="server">
<div style="text-align: left; float: left; width: 80%; height: 100%;">
<asp:Label ID="lblShowFooter" runat="server" CssClass="" Visible="True">See All Eggs (Deviled, Pickled)</asp:Label>
</div>
<div style="text-align: right;">
<asp:LinkButton ID="btnShowPickledOrDeviled" runat="server" OnClick="ShowOrHidePickledOrDeviled" CssClass="" Visible="True" CommandName="ShowPickledOrDeviled">
<i id="iShowPickledOrDeviled" class="fa fa-plus-square-o" style="font-size: 40px;" title="Show Eggs with 'Deviled' and 'Pickled' grades"></i>
</asp:LinkButton>
</div>
</div>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Name" SortExpression="EggName" HeaderStyle-CssClass="visible-md visible-lg" ItemStyle-CssClass="visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblEggName" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggName") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Grade" SortExpression="EggGrade" HeaderStyle-CssClass="visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:Label ID="lblGrade" Runat="server" />
<asp:Label ID="lblGradeErrorMsg" Runat="server" />
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Confirm Grade" SortExpression="Grade" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:dropdownlist id="ddlConfirmGrade" Runat="server"></asp:dropdownlist>
<asp:Label ID="lblConfirmGrade" Runat="server" />
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Edible End Date" Visible="False" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblEdibleEndDate" Runat="server" text='<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "EdibleEndDate2"))%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Egg Grade Sync Date" Visible="False" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblEggGradeUpdatedDate" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "EggGradeUpdatedDate") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Expiration" SortExpression="ExpirationStopDate" HeaderStyle-CssClass="visible-lg" ItemStyle-CssClass="visible-lg">
<ItemTemplate>
<asp:Label id="lblExpirationStopDate" Runat="server" text='<%# String.Format("{0:MM/dd/yyyy}", DataBinder.Eval(Container.DataItem, "ExpirationStopDate"))%>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Reason for Grade Change" SortExpression="GradeChangeDescription" HeaderStyle-CssClass="visible-xs visible-sm visible-md visible-lg" ItemStyle-CssClass="visible-xs visible-sm visible-md visible-lg">
<ItemTemplate>
<asp:dropdownlist id="ddlGradeChangeReason" Runat="server"></asp:dropdownlist>
<asp:Label id="lblReasonErrorMsg" Font-Size="10px" Runat="server"></asp:Label><INPUT id=hiRegistrationID type=hidden value='<%# DataBinder.Eval(Container.DataItem, "RegistrationID") %>' name=hiRegistrationID Runat="server"></input>
<input id="hiCurrLetGrade" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "Grade") %>' name=hiCurrLetGrade Runat="server">
<input id="hiCurrLetGradeID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeID") %>' name=hiCurrLetGradeID Runat="server">
<input id="hiGradeEnteredDate" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeEnteredDate") %>' name="hiGradeEnteredDate" Runat="server" />
<input id="hiEggEmail" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "Email") %>' name="hiEggEmail" Runat="server" />
<input id="hiQualityStatusID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "CurrentQualityStatusID") %>' name="hiQualityStatusID" Runat="server" />
<input id="hiEggLaidDate" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "EggLaidDate") %>' name="hiEggLaidDate" Runat="server" />
<input id="hiStoreName" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "StoreName") %>' name="hiStoreName" Runat="server" />
<input id="hiTypeAEgg" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "TypeAEgg") %>' name="hiTypeAEgg" Runat="server" />
<input id="hiTypeBEgg" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "IsTypeBEgg") %>' name="hiTypeBEgg" Runat="server" />
<input id="hiEdibleTypeID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "EdibleTypeID") %>' name="hiEdibleTypeID" Runat="server" />
<input id="hiGradeChangeReasonID" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeChangeReasonID") %>' name=hiGradeChangeReasonID Runat="server">
<input id="hiGradeChangeDescription" type="hidden" value='<%# DataBinder.Eval(Container.DataItem, "GradeChangeDescription") %>' name=hiGradeChangeDescription Runat="server">
<asp:Label ID ="lblCurrLetGrade" EnableViewState ="True" Visible = "False" Runat = "server" Text = '<%# DataBinder.Eval(Container.DataItem, "Grade") %>'></asp:Label>
<asp:Label ID ="lblEggGrade" EnableViewState ="True" Visible = "False" Runat = "server" Text = '<%# DataBinder.Eval(Container.DataItem, "EggGrade") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</div>
</div>