![](/img/trans.png)
[英]Is there a way to turn off logging that Hangfire does with serilog?
[英]Easier way to turn off paging
我想取消我的gridview的分頁。 我通過重定向在javascript中執行此操作。 我會在下面解釋。 但是我寧願取消分頁,只在更新面板中重新加載Gridview。 那怎么辦?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Request.Params("R") = "1" Then
GridView1.AllowPaging = False
End If
End Sub
function Paging(remove) {
var txt = $get('<%=TextBox1.ClientID%>');
var query = window.location.search.substring(1);
//alert (query);
window.location = url + 'R=' + remove ;
txt.value = txt.value;
}
Dim bttnrempag As New Button
bttnrempag.ID = "bttnrempag"
bttnrempag.Text = " Paging"
bttnrempag.CssClass = "bttnMinEG"
bttnrempag.ValidationGroup = "alone"
bttnrempag.Attributes.Add("onclick", "Paging('1')")
Dim bttnallowpag As New Button
bttnallowpag.ID = "bttnallowpag"
bttnallowpag.Text = " Paging"
bttnallowpag.ValidationGroup = "alone"
bttnallowpag.CssClass = "bttnAddEG"
bttnallowpag.Attributes.Add("onclick", "Paging('0')")
//this is where i add the buttons to my Gridview
cell.Controls.Add(bttnrempag) '36
cell.Controls.Add(bttnallowpag)
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate >
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF"
BorderStyle="None" BorderWidth="1px" CellPadding="3"
DataSourceID="SqlDataSource1" Font-Names="Comic Sans MS" Font-Size="XX-Small"
Font-Bold="True" PageSize="15" >
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<Columns>
<asp:BoundField DataField="scan" HeaderText="Scan" SortExpression="scan" />
<asp:BoundField DataField="ScanType" HeaderText="ScanType" ReadOnly="True"
SortExpression="ScanType" />
<asp:TemplateField HeaderText="Item Desc."></asp:TemplateField>
<asp:BoundField />
<asp:BoundField />
<asp:BoundField />
<asp:BoundField />
<asp:BoundField />
<asp:BoundField />
<asp:BoundField />
</Columns>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<EmptyDataTemplate>
<head>
<meta http-equiv="refresh" content="5;URL=/Corporate_newpo/ReceivingLog.aspx?">
</head>
<script type="text/javascript" >
var count = 6;
var counter = setInterval("timer()", 1000); //1000 will run it every 1 second
function timer() {
count = count - 1;
if (count <= 0) {
clearInterval(counter);
//counter ended, do something here
return;
}
$get("timer").innerHTML = "The Table will Reload in " + count + " secs";
}
</script>
<asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Size="Large"
ForeColor="#993333" Text="No Data was Found for the Selected Filter"></asp:Label><br /><br />
<span id="timer" style="font-size:medium;color:blue"></span>
</EmptyDataTemplate>
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
當然,我在網格中有數據。 我只是不在這里顯示。 我如何在不使用變量重定向的情況下關閉分頁,就像我在JavaScript中使用R一樣?
這是用於關閉網格視圖控件分頁的Javasscript
// get datagrid by rendered table name
var myGridView = document.getElementById('<%= grdvCategoryList.ClientID % >');
var intNumberOfRows = myGridView.rows.length;
myGridView.rows[intNumberOfRows-1].style.visibility='hidden';
myGridView.rows[intNumberOfRows-1].style.display='none';
return false;
這將隱藏網格視圖控件的最后一行。 希望對您有所幫助。
在UpdatePanel內添加一些可實現此目的的按鈕:
GridView1.AllowPaging = False
GridView1.DataBind()
GridView1.AllowPaging = True
GridView1.DataBind()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.