重复网格在向下滚动时在单个页面上绑定serverl次数 [英] Duplicate grid binds serverl times on a single page on scrolling down
本文介绍了重复网格在向下滚动时在单个页面上绑定serverl次数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
在使用每行的别名时我在滚动网格时获得多个重复网格
我尝试过:
Hi
While Using the alias names of each row I am getting multiple Duplicate Grids on scrolling Down the grid
What I have tried:
<pre>SELECT T.DeptID As DeptID ,SUM(CASE WHEN datepart(yyyy,T.DOJ) between 2005 and 2017 and T.Status =0 then 1 else 0 END) As TotalHeadCount,
SUM(CASE when T.DOJ >= cast('2017-01-12' as datetime) and T.Status =0 then 1 else 0 END) As NewJoinees1,
SUM (CASE When T.deactivate>= Cast('2017-01-12' as datetime) and T.Status =0 then 0 else 1 END) As Resigned1,
SUM(CASE WHEN T1.Tobehired IS NULL THEN '0' ELSE Tobehired END) AS Tobehired ,
SUM(CASE WHEN T1.Openposition IS NULL THEN '0' ELSE Openposition END) As Openposition ,T1.Status As Status
FROM EmployeeDetails T LEFT JOIN RecruitmentDetails1 T1 on T.DeptID = T1.DeptID
Where T.Status=0
GROUP BY T.DeptID
, T1.Tobehired
, T1.Openposition
, T1.Status
<pre><asp:View ID="View2" runat="server">
<br />
<br />
<table align="center" class="table table-bordered">
<tr valign="middle">
<td>Month
</td>
<td>
<asp:DropDownList ID="ddlMonths" runat="server"></asp:DropDownList>
<%--<asp:TextBox ID="txtmonth" runat="server"></asp:TextBox>--%>
</td>
<td>Year
</td>
<td>
<%--<asp:TextBox ID="txtyear" runat="server"></asp:TextBox>--%>
<asp:DropDownList ID="ddlyear" runat="server"></asp:DropDownList>
</td>
<td>
<asp:Button ID="btnGenerate" runat="server" CssClass="btn btn-wide btn-dark-grey" Text="Find" OnClick="btnGenerate_Click" />
</td>
</tr>
</table>
<table align="center">
<tr>
<td>
<span id="printcontent1">
<asp:DataList ID="DataListHeadCount" HorizontalAlign="Center" DataSourceID="SqlDataSourceHeadCount" runat="server">
<ItemTemplate>
<table align="center" class="table table-bordered">
<tr align="center">
<td>Data
</td>
<td>COUNT
</td>
</tr>
<tr>
<td>NEW JOINEES
</td>
<td align="center">
</td>
</tr>
<tr>
<td>RESIGNATIONS
</td>
<td align="center">
</td>
</tr>
<tr>
<td>TOTAL HEADCOUNT
</td>
<td align="center">
</td>
</tr>
</table>
<div>
<table >
<tr>
<td
colspan="7" align="center">
<%=ddlMonths.Text %><%=ddlyear.Text %></td>
</tr>
<tr>
<td>
<asp:GridView ID="grdvEmployeeLeaveUpdate" runat="server" DataKeyNames=""
class="table table-bordered table-striped table-hover" DataSourceID="SqlDataSourceHeadCount"
OnRowDataBound="grdvEmployeeLeaveUpdate_RowDataBound" AutoGenerateColumns="False" Width="100%"
OnRowDeleting="grdvEmployeeLeaveUpdate_RowDeleting"
OnRowEditing="grdvEmployeeLeaveUpdate_RowEditing"
OnRowUpdating="grdvEmployeeLeaveUpdate_RowUpdating"
OnRowCancelingEdit="grdvEmployeeLeaveUpdate_RowCancelingEdit"
OnPageIndexChanging="grdvEmployeeLeaveUpdate_PageIndexChanging">
<Columns>
<asp:BoundField DataField="DeptID" HeaderText="Cost Center" ReadOnly="true" />
<asp:BoundField DataField="TotalHeadCount" HeaderText="HeadCount" ReadOnly="true" />
<asp:BoundField DataField="NewJoinees1" HeaderText="Additions" ReadOnly="true" />
<asp:BoundField DataField="Resigned1" HeaderText="Separations" ReadOnly="true" />
<asp:BoundField DataField="Tobehired" HeaderText="To Be Hired" ControlStyle-Width="80px" />
<asp:BoundField DataField="Openposition" HeaderText="Open Position" ControlStyle-Width="80px" />
<asp:BoundField DataField="Status" HeaderText="Status" ControlStyle-Width="80px" />
<asp:CommandField HeaderText="Update" ShowEditButton="True" ControlStyle-Width="80px" />
</Columns>
<HeaderStyle></HeaderStyle>
</asp:GridView>
</td>
</tr>
</table>
</div>
</ItemTemplate>
</asp:DataList>
</span>
</td>
</tr>
</table>
<table align="center">
<tr valign="middle" align="center">
<td align="center">
<asp:Button ID="btnExport" runat="server" CssClass="btn btn-wide btn-dark-grey" Text="Export To Excel" OnClick="btnExport_Click" />
<input id="Button2" class="btn btn-wide btn-dark-grey" onclick="return doprintcontent1();" type="button" value="Print Page" />
</td>
</tr>
</table>
<asp:SqlDataSource ID="SqlDataSourceHeadCount" runat="server" ConnectionString="<%$ ConnectionStrings:TimeSheetConnectionString2 %>"
SelectCommandType="StoredProcedure" SelectCommand="Sampe4"
UpdateCommand="UPDATE RecruitmentDetails1 SET Tobehired = @Tobehired, Openposition = @Openposition, Status=@Status WHERE DeptID = @DeptID">
<SelectParameters>
<asp:ControlParameter ControlID="ddlMonths" Name="months" Type="Int32" />
<asp:ControlParameter ControlID="ddlyear" Name="years" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</asp:View>
推荐答案
ConnectionStrings:TimeSheetConnectionString2%>
SelectCommandType =StoredProcedure SelectCommand =Sampe4
UpdateCommand =UPDATE RecruitmentDetails1 SET Tobehired = @Tobehired,Openposition = @Openposition,Status = @ Status WHERE DeptID = @DeptID>
< SelectParameters>
< asp:ControlParameter ControlID =ddlMonthsName =monthsType =Int32/>
< asp:ControlParameter ControlID =ddlyearName =yearsType =Int32/>
< / SelectParameters>
< / asp:SqlDataSource>
< / asp:查看>
ConnectionStrings:TimeSheetConnectionString2 %>" SelectCommandType="StoredProcedure" SelectCommand="Sampe4" UpdateCommand="UPDATE RecruitmentDetails1 SET Tobehired = @Tobehired, Openposition = @Openposition, Status=@Status WHERE DeptID = @DeptID"> <SelectParameters> <asp:ControlParameter ControlID="ddlMonths" Name="months" Type="Int32" /> <asp:ControlParameter ControlID="ddlyear" Name="years" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> </asp:View>
你需要给每一行它自己的id或类。简单的解决方法就是把你的表放在里面一个容器。最好的方法是将容器的高度和宽度设置为固定高度。
You need to give every row it's own id or class. Simple fix is to put your table inside a container. Also best way is to set the container with a height and width as fixed height.
<div id="my-table">
//add table here
</div>
这篇关于重复网格在向下滚动时在单个页面上绑定serverl次数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文