易截截图软件、单文件、免安装、纯绿色、仅160KB

用AspNetPager和ViewState分别实现asp.net分页

以下介绍两种分页,用AspNetPager和ViewState
一.AspNetPager的用法
1. 复制AspNetPager.dll到bin目录,在工具箱->选择项->浏览,添加bin下的引用。
2. 从工具箱拖个AspNetPager,改如下属性:
    PageSize--每页显示的记录数
    CustomInfoHTML--自定义显示文本,一般为“第%CurrentPageIndex%页 共%PageCount%页”
    ShowCustomInfoSection--显示当前页和总页数信息,值为Never,Right,Left
    AlwaysShow--总是显示分页控件
    PageIndexBoxType--指定页索引框的显示类型,值为文本框,下拉列表框
    ShowPageIndexBox--指定页索引框的显示方式,值为Always,Never,Auto
    TextAfterPageIndexBox--页索引框后的文本内容,一般为“页”
    TextBeforePageIndexBox--页索引框前的文本内容,一般为“转到”
显示如下
3. 在AspNetPager的PageChanged事件中写如下代码:
     protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        Databind();
    }
    private void Databind()
    {
        PagedDataSource pds = new PagedDataSource();
        pds.DataSource = List<T>;
        pds.AllowPaging = true;
        pds.PageSize = AspNetPager1.PageSize;        //AspNetPager1是ID
        AspNetPager1.RecordCount = pds.DataSourceCount;
        pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
        GridView1.DataSource = pds;        //绑定到GridView
        GridView1.DataBind();
    }
二. ViewState
  1.四个按钮触发以下


相关文档:

C#(ASP.Net)获取当前路径的方法集合

//获取当前进程的完整路径,包含文件名(进程名)。  
string str = this.GetType().Assembly.Location;  
result: X:\xxx\xxx\xxx.exe (.exe文件所在的目录+.exe文件名)  
//获取新的 Process 组件并将其与当前活动的进程关联的主模块的完整路径,包含文件名(进程名)。  
s ......

asp.net后台验证类

/// <summary>
    /// 提供经常需要使用的一些验证逻辑。 比如 邮箱是否合法
    /// </summary>
    public class Validator
    {
        /// <summary>
     &nbs ......

asp.net TextBox只读时不能通过后台赋值取值解决办法


给页面的TextBox设置ReadOnly="True"时,在后台代码中不能赋值取值,下边几种方法可以避免:
1、不设置ReadOnly,设置onfocus=this.blur()
C#代码
<asp:TextBox ID="TextBox1" runat="server" onfocus=this.blur()></asp:TextBox>  
<asp:TextBox ID="TextBox1" runat="serve ......

使用ASP.NET的权限系统

1. 生成aspnet的权限数据表和sp,使用.net 2.0的命令如下:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regsql -W
使用-W参数调出连接数据库向导,根据向导生成数据库数据。
2. 在web.config更改验证方式并添加providers
<configuration>
<connectionStrings>
<add name="dbConn ......

ASP.NET与JavaScript交互

1.asp.net呼叫js
view
plain
copy
to clipboard
print
?
Response.Write("<mce:script language=javascript><!--  
");  
Response.Write("alert('欢迎您 ');"
 );  
Response.Write("location.href='login.aspx';"
)& ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号