一、      关于DataGrid的分页
除了设置:

AllowPaging是指允许分页,这个是最主要的。有了它,我们才能分页。

PageSize是指定每页显示的记录数,如果不写,就会默认为10条。

外,还要加入:

OnPageIndexChanged="DataGrid1_PageIndexChanged"

public void DataGrid1_PageIndexChanged(object sender, DataGridPageChangedEventArgs e)

{

DataGrid1.CurrentPageIndex =e.NewPageIndex;

DataGrid1.DataBind();

}

二、      关于上传文件
上传文件应加入:

<form id="Form1" enctype="multipart/form-data" method="post" runat="server">

源文件里边加入:

if(File1.PostedFile !=null)

{

File1.PostedFile.SaveAs (Server.MapPath ("\\1.jpg"));

Image1.ImageUrl =Server.MapPath ("\\1.jpg");

}

三、      关于自动刷新
HTML应加入:

<meta http-equiv ="REFRESH" content ="10;URL=chat.aspx">

自动窗口ScrollWindow():

<script language =javascript 1.1>

function scrollWindow()

{

this.scroll(0,65000);

setTimeout('scrollWindow()',200);

}

scrollWindow();

</script>

四、      连到SQL数据库
                     string _sql;

SqlConnection cn;

_sql="server=localhost;uid=sa;pwd=hz0222;database=Northwind";

cn=new SqlConnection (_sql);

cn.Open ();

//SqlCommand cmd =new SqlCommand ("select * from Products ",cn);

//SqlDataReader rs;

//rs=cmd.ExecuteReader();

SqlDataAdapter da=new SqlDataAdapter ("select * from Products",cn);

DataSet ds=new DataSet ();

da.Fill (ds,"Products");

DataGrid1.DataSource =ds.Tables["Products"].DefaultView ;

//DataGrid1.CurrentPageIndex = 0;

DataGrid1.DataBind ();

cn.Close ();

五、      查询IP地址
              private void Button6_Click(object sender, System.EventArgs e)

{

IPHostEntry hostInfo = Dns.GetHostByName(txtDomain.Text);

Response.Write ("<br>" +hostInfo.AddressList[0].ToString());

}

当然记得用引名字空间 System.Net

六、      在HTML中加载处理页面
       <form method="post" action="index2.aspx">

七、      使用TreeView控件
a)    下载并安装IEWebControls:http://www.asp.net/IEWebControls/Download.aspx

b)    安装完以后,默认状态下会建立一个目录:\Program files\IEWeb Controls\,当然你也可改变安装目录。找到这个目录,双击build.bat文件执行,它会建立一个名为build的子目录,并且编译在src目录下的源文件,把编译结果和Runtime目录复制到build子目录中(自动)。在这个动作之后,在build目录下应该会有一个叫"Microsoft.Web.UI.WebControls.dll"文件和一个Runtime子目录。为了能在ASP.NET的Web应用程序中使用这个控件,你必须把\build\Runtime子目录下的内容复制到Web应用程序的 /webctrl_client/1_0子目录中,并且把"Microsoft.Web.UI.WebControls.dll"这个文件复制到Web应用程序的/bin目录下。这个过程在Readme.txt文件有详细的说明,不过是英文的。

c)    然后,你就可以在Toolbox中添加一个工具了(这个不用说明了吧)

d)    以下是WebControls的说明书(E文)

To run the IE Web Controls:

1.  Copy the contents of the Runtime directory to the webctrl_client\1_0

directory under your top-level site directory.  For example, if your

site root is c:\Inetpub\wwwroot, type this at the command prompt:

xcopy /s /i .\build\Runtime c:\Inetpub\wwwroot\webctrl_client\1_0 /y

This will create the following directory structure under the site:

/webctrl_client/1_0

MultiPage.htc

TabStrip.htc

toolbar.htc

treeview.htc

webservice.htc

webserviced.htc

[images]

[treeimages]

2.  Create a new web application in IIS and copy the contents of the

samples directory to this application directory.  For example:

xcopy /s /i .\samples c:\Inetpub\wwwroot\sampleapp /y

3.  Create a /bin subdirectory for the application and copy the file

Microsoft.Web.UI.WebControls.dll to this directory.

The contents of the application will be as follows:

/sampleapp

multipage.aspx

state_city.xml

tabstrip.aspx

toolbar.aspx

treeview.aspx

treeview_bound.aspx

/bin

Microsoft.Web.UI.WebControls.dll

4.  Request the sample pages from your Internet Explorer web browser, for

example: http://localhost/sampleapp/multipage.aspx

八、      取消IE内容安全验证
a)    validateRequest="false"

九、      第三方的Dtable控件使用方法
a)    一定要把HTML中的<form……去掉

b)    所连接的表的第一个字段必需是自动编号的int类型,Sql的验证最好加上ASP.NET这个帐号

c)    其它问题请参考论坛http://dtable.2smm.com

转载于:https://www.cnblogs.com/BoKeRen/archive/2006/03/01/340294.html

ASP.NET学习笔记 1相关推荐

  1. ASP.Net学习笔记015--ASP.Net中使用Cookie

    ASP.Net学习笔记015--ASP.Net中使用Cookie 表单数据欺骗: 原理跟收到欺骗短信一样,移动信号塔[基站],伪装的移动信号塔会屏蔽移动信号,并且 在信号范围内的手机会自动切换为接收伪 ...

  2. ASP.Net学习笔记014--ViewState初探3

    ASP.Net学习笔记014--ViewState初探3 为什么禁用了viewstate,还能修改label2的值 因为:viewstate只是记录label2的值,并不影响给label2进行设置 - ...

  3. ASP.Net学习笔记013--ViewState初探2

    ASP.Net学习笔记013--ViewState初探2 上课讲的viewstate,由于需要跟后台服务器进行传值,需要封装很多隐藏列,比如100条数据,就会有100个viewstate 如果用在一些 ...

  4. ASP.Net学习笔记008--ASP.Net揭秘之Input版自增补充说明

    以前写的课程都没有附上源码,很抱歉! ASP.Net学习笔记007ASP.Net Input版自增.zip http://credream.7958.com/down_20155694.html 1. ...

  5. ASP.Net学习笔记007--ASP.Net Input版自增

    2016/1/18 以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交流qq2群:170933152 也可以自己下载: ...

  6. ASP.Net学习笔记006--Get和Post的区别

    以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交流qq2群:170933152 也可以自己下载: ASP.Net学习 ...

  7. ASP.Net学习笔记005--ASP.Net的IsPostBack揭秘

    以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交流qq2群:170933152 也可以自己下载: ASP.Net学习 ...

  8. ASP.Net学习笔记004--基于ashx方式的ASP.Net开发1

    以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交流qq2群:170933152 也可以自己下载: ASP.Net学习 ...

  9. ASP.Net学习笔记003--网站和WebApplication的区别

    以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交流qq2群:170933152 也可以自己下载: ASP.Net学习 ...

  10. ASP.Net学习笔记002--ASP.Net服务端控件做了什么2

    ASP.Net学习笔记002--ASP.Net服务端控件做了什么2 以前写的课程都没有附上源码,很抱歉! 课程中的源码可以加qq索要:1606841559 技术交流qq1群:251572072 技术交 ...

最新文章

  1. Secure-CRT使用技巧
  2. PyTorch中MaxPool的ceil_mode属性
  3. 用Hadoop1.0.3实现KMeans算法
  4. 判断101-200之间有多少个素数,并输出所有素数(C)
  5. ios调用restful接口_Postman调用https异常解决
  6. php中怎样表示组合框,php – 如何实现动态组合框选择系统
  7. Gearman 启动日志文件提示协议出错的BUG
  8. java 字符串 常量_Java进阶——Java中的字符串常量池
  9. 用sum函数求三个数和C语言,C语言用函数写两数之和.doc
  10. 哪本书是对程序员最有影响(stackoverflow)
  11. mysql update form_Update From 用法 | 蒲公英网
  12. HDU1229 还是A+B【水题】
  13. 电脑突然出现成功连接网络但不能上网、网络受限(解决办法)
  14. 基于VB6.0的MICAPS风云二号卫星云图转化实例(转载)
  15. Unity 修改asset store下载路径(win10)
  16. 实验九 TCP 协议分析实验
  17. 苹果的airplayer推荐
  18. 解析SRAM存储容量及基本特点
  19. matlab 取数组第一行,matlab中如取数组的矩阵的一行出来成为一个向量?
  20. 讲的是切片,但好像又不只是切片?

热门文章

  1. 布尔类型和三目运算符
  2. [ Luogu 3924 ] 康纳的线段树
  3. Redis缓存使用技巧
  4. CentOS 6.5 手动rpm包安装gcc、g++
  5. declare handler 声明异常处理的语法
  6. 关于服务器端控件的attributes属性的奇怪问题
  7. linux下java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider解决方法
  8. idea解决@Data注解报红问题
  9. shiro解决一个账号异地登录的问题
  10. 在Ruby中获取system()调用的输出