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

ASP.NET(C#)返回上一页(后退)代码

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        ViewState["BackUrl"] = Request.UrlReferrer.ToString();
    }
}
/// <summary>
/// 返回按钮点击事件
/// </summary>
protected void Button1_Click(object sender, EventArgs e)
{
    Response.Redirect(ViewState["BackUrl"].ToString());
}
另一种方法
在C# Web程序中,如为页面按钮写返回上一页代码
this.RegisterClientScriptBlock("E", "<script language=javascript>history.go(-2);</script>");
其中,history.go(-2),要写为-2,因在按钮事件触发前,已刷新一次页面,所以应是-2。
Response.Write("<script language=javascript>history.go(-2);</script>");
此处也要写为“-2”。跟直接写脚本的有所不同。


相关文档:

C#中继承实现父类方法、重写、重载

继承是派生类(子类)去实现(重写<override>、重构<new>)基类(父类)的方法或属性。从而获取在派生类中要实现的功能。
子类调用父类构造方法,在父类中有个实现姓名和年龄的构造方法但是中子类也要实现这样的功能这时子类不用再次去写这个功能只要去调用父类的功能即可。
public class Person
 & ......

C#利用winapi定位控件位置算法

public struct RECT
{
      public int left;
      public int Top;
      public int Right;
      public int Bottom;
}
public static bool CenterMouseOn(int hwnd)
{
     ......

C#与Firebird开发 查询返回别名中文字段

最近在忙于 将租赁管理系统mssql数据库转移至firebird数据 以减少成本负担 这个常见问题解决方案留给大家 有更好的或者撇砖块的来着不拒 呵呵
MS-sql在通常 C#代码里 我们提交一个查询字符串 只需如: string sql=" select id 编号,[name] 姓名,sex 性别 from users";
提交即可返回table
但是在 firebird在字段 命名或者 ......

asp.net(C#)字符串加密

asp.net(C#)字符串加密
2010-03-12 09:59
using System;   
using System.Collections.Generic;   
using System.Text;   
using System.Security.Cryptography;//Cryptography密码术   
namespace DAL   
{   
......

ASP.NET 用代码创建HtmlTable

ASP.NET 2.0
文件1: Deafault.aspx
<%@ Page Language="C#" AutoEventWireup="true"      CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&l ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号