UserControlPage.ascx
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:5k
源码类别:

.net编程

开发平台:

C#

  1. <%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserControlPage.ascx.cs" Inherits="UserControl_UserControlPage" %>
  2. <script type="text/javascript">    
  3.     function callButtonEvent()
  4.     {
  5.         var keycode =window.event.keyCode;
  6.         if(keycode==13)
  7.         {
  8.             if(check()==true)
  9.             {
  10.                 event.cancelBubble=true;
  11.                 event.returnValue=false;
  12.                 document.getElementById('<%=btnGo.ClientID%>').click();
  13.             }
  14.         }
  15.     }
  16.     function check()
  17.     {
  18.         var count =  parseInt(document.getElementById('<%=ltTotal.ClientID%>').outerText);
  19. //        document.getElementById('<%=labOf.ClientID%>').outerText;
  20.         var txt = document.getElementById('<%=txtCurrentPage.ClientID%>').value;
  21.         var cur = parseInt(txt);
  22.         if (cur > count || cur < 1)
  23.         {
  24.             alert('系统提示:数字超出实际范围!'); 
  25.             event.cancelPostBack=true;
  26.             return false;
  27.         }
  28.         if ((cur | NaN) ==0)
  29.         {
  30.             alert('系统提示:请输入数字!');
  31.             event.cancelPostBack=true;            
  32.             return false;
  33.         }
  34.     }
  35. </script>
  36. <table id="Table1" cellpadding="0" cellspacing="0" width="100%" border="0" style="font-size:12px;">
  37.     <colgroup>
  38.         <%--<col width="400">
  39.         <col width="50">
  40.         <col width="50">
  41.         <col width="40">
  42.         <col width="20">
  43.         <col width="40">
  44.         <col width="40">
  45.         <col width="50">
  46.         <col width="70">--%>
  47.     </colgroup>
  48.     <%--<tr>
  49.     <td>
  50.         <asp:Label ID="LabelCurrentPage" runat="server">当前页:<%# ((GridView)Container.NamingContainer).PageIndex + 1 %></asp:Label>&nbsp;
  51.          &nbsp;
  52.         <asp:Label ID="LabelPageCount" runat="server">总页数:<%# ((GridView)Container.NamingContainer).PageCount %></asp:Label>&nbsp;
  53.         &nbsp;
  54.         <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
  55.             Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首页</asp:LinkButton>&nbsp;
  56.         &nbsp;
  57.         <asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev"
  58.             CommandName="Page" Enable="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一页</asp:LinkButton>&nbsp;
  59.         &nbsp;
  60.         <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
  61.             Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一页</asp:LinkButton>&nbsp;
  62.         &nbsp;
  63.         <asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"
  64.             Enable="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾页</asp:LinkButton>&nbsp;
  65.         &nbsp; 转到第:<asp:TextBox ID="LinkTextBoxNewPage" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'
  66.             Width="20px"></asp:TextBox>页&nbsp; &nbsp;
  67.         <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="LinkTextBoxNewPage"
  68.             Display="Dynamic" ErrorMessage="0-99999" MaximumValue="99999" MinimumValue="0"
  69.             ValidationGroup="goto"></asp:RangeValidator>
  70.         <asp:LinkButton ID="btnGo" runat="server" CausesValidation="False" CommandArgument="-1"
  71.             CommandName="Page" Text="GO" ValidationGroup="goto"></asp:LinkButton>
  72.     </td>
  73.     </tr>--%>
  74.     
  75.     <tr align="center">
  76.         <td>
  77.         <ASP:LABEL ID="labOf" RUNAT="server">当前页:</ASP:LABEL><asp:Label ID="lbCurrent" runat="server"></asp:Label>
  78.         &nbsp;
  79.         <ASP:LABEL ID="lblTotal" RUNAT="server">总页数:</ASP:LABEL><asp:Label ID="ltTotal" runat="server"></asp:Label>
  80.         &nbsp;
  81.         <asp:LinkButton id="btnFirstPage" runat="server" CommandArgument="First">第一页</asp:LinkButton>
  82.         &nbsp;
  83.         <asp:LinkButton id="btnPrevPage" runat="server" CommandArgument="Prev">上一页</asp:LinkButton>
  84.         &nbsp;
  85.         <asp:LinkButton id="btnNextPage" runat="server" CommandArgument="Next">下一页</asp:LinkButton>
  86.         &nbsp;
  87.         <asp:LinkButton id="btnLastPage" runat="server" CommandArgument="Last">最后一页</asp:LinkButton>
  88.         &nbsp;
  89.         跳转至:<ASP:TEXTBOX ID="txtCurrentPage" runat="server" MaxLength="5" Width="40" Height="16">0</ASP:TEXTBOX>
  90.         &nbsp;
  91.         <ASP:LinkButton ID="btnGo" runat="server" text="Go" CommandArgument="Go" CausesValidation="False" ToolTip="转到"></ASP:LinkButton>
  92.         &nbsp;
  93.         </td>
  94.     </tr>
  95. </table>