随笔(informal essay)

ASP.NET 打开新页面或页面跳转

1.最常用的页面跳转(原窗口被替代):Response.Redirect(“XXX.aspx”);

2.利用url地址打开本地网页或互联网:Respose.Write(“<script language=’javascript’>window.open(‘”+ url+”‘);</script>”);

3.原窗口保留再新打开另一个页面(浏览器可能阻止,需要解除):Response.Write(“<script>window.open(‘XXX.aspx’,’_blank’)</script>”);

4.效果同1中的另一种写法:Response.Write(“<script>window.location=’XXX.aspx'</script>”);

5.也是原窗口被替代的 (常用于传递session变量的页面跳转):Server.Transfer(“XXX.aspx”);

6.原窗口保留,以对话框形式打开新窗口:Response.Write(“<script>window.showModelessDialog(‘XXX.aspx’)</script>”);

7.对话框形式打开新窗口,原窗口被代替:Response.Write(“<script>window.showModelDialog(‘XXX.aspx’)</script>”);

8.打开简洁窗口:Respose.Write(“<script language=’javascript’>window.open(‘”+url+”‘,”,’resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no’);</script>”);

GridView的RowDeleting事件

a、RowDeleting发生在删除数据之前,RowDeleted发生在删除数据之后。

b、使用RowDeleting事件,可以在真正删除前再次确认是否删除,可以通过设置GridViewDeleteEventArgs.Cancel=True来取消删除;也可以用于判断当前数据库记录数,如果只剩一条记录且数据库不能为空则提示并取消删除操作。

c、使用RowDeleted事件,可以在删除后,通过GridViewDeletedEventArgs的Exception属性判断删除过程中

d、RowDeleting单击某一行的“删除”按钮后,在 GridView 控件删除该行之前,将引发RowDeleting事件,此时还可以取消删除操作,如有必要,您还可以在将值传递给数据源之前操作 Keys 和 Values 集合。

keys、values、items区别

keys()获取字典中所有的键并放入列表

values()获取字典中所有的值并放入列表

items()获取字典中所有的键值对并放入列表

————————

Asp.net opens a new page or page Jump

1. The most commonly used page Jump (the original window is replaced): response. Redirect (“XXX. ASPX”);

2. Open the local web page or Internet with the URL address: repose. Write (“& lt; script language =’javascript ‘& gt; window. Open (‘ + URL +” ‘); & lt; / script & gt;);

3. Keep the original window and open another page (the browser may block it and need to be released): response. Write (“& lt; script & gt; window. Open (‘xxx. ASPX ‘,’ _blank ‘) & lt; / script & gt;);

4. The effect is the same as another writing method in 1: response. Write (“& lt; script & gt; window. Location =’xxx. ASPX ‘& lt; / script & gt;);

5. It is also replaced by the original window (page Jump commonly used to transfer session variables): server. Transfer (“XXX. ASPX”);

6. Keep the original window and open a new window in the form of a dialog box: response. Write (“& lt; script & gt; window. Showmodelessdialog (‘xxx. ASPX ‘) & lt; / script & gt;);

7. Open a new window in the form of dialog box, and the original window is replaced by: response. Write (“& lt; script & gt; window. Showmodeldialog (‘xxx. ASPX ‘) & lt; / script & gt;);

8.打开简洁窗口:Respose.Write(“<script language=’javascript’>window.open(‘”+url+”‘,”,’resizable=1,scrollbars=0,status=1,menubar=no,toolbar=no,location=no, menu=no’);</script>”);

GridView的RowDeleting事件

a. Rowdeleting occurs before deleting data, and rowdeleted occurs after deleting data.

b. Using the rowdeleting event, you can confirm whether to delete again before the real deletion. You can cancel the deletion by setting gridviewdeleteeventargs. Cancel = true; It can also be used to determine the number of records in the current database. If there is only one record left and the database cannot be empty, you will be prompted and cancel the deletion operation.

c. Using the rowdeleted event, you can judge the deletion process through the exception property of gridviewdeletedeventargs after deletion

d. Rowdeletion after clicking the delete button of a row, a rowdeletion event will be raised before the GridView control deletes the row. At this time, you can also cancel the deletion operation. If necessary, you can also operate the keys and values collection before passing the value to the data source.

keys、values、items区别

Keys () gets all the keys in the dictionary and puts them in the list

Values () gets all the values in the dictionary and puts them in the list

Items() gets all the key value pairs in the dictionary and puts them in the list