1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Attributes.Add("onclick","return confirm('确认?')");
button.attributes.add("onclick","if(confirm('are you sure...?')){return true;}else{return false;}")
3.删除表格选定记录
int intEmpID = (int)MyDataGrid.DataKeys[e.Item.ItemIndex];
string deleteCmd = "DELETE from Employee where emp_id = " + intEmpID.ToString()
4.删除表格记录警告
private void DataGrid_ItemCreated(Object sender,DataGridItemEventArgs e)
{
switch(e.Item.ItemType)
{
case ListItemType.Item :
case ListItemType.AlternatingItem :
case ListItemType.EditItem:
TableCell myTableCell;
myTableCell = e.Item.Cells[14];
LinkButton myDeleteButton ;
myDeleteButton = (LinkButton)myTableCell.Controls[0];
myDeleteButton.Attributes.Add("onc ......
常用函数系列:
public static string Get_ClientIP() 得到客户端IP
public static string Get_CMac(string IP) 得到客户端 CMac 地址
public static string RequestF(string xPName,string xPType,int xLenDef) 安全接收数据系列
public static string Show_Cont(string xStr) 过滤显示字串
public static string Show_jsStr(string xStr) 过滤显示js
安全检测函数:
public static string CheckUrl(string xDirPage) 上页地址认证
public static string Chk_Perm0(string xPerm,string xSys,string xAct) 权限认证系列
public static string Chk_Perm1(string xPerm,string xSys,string xAct) 权限认证系列
public static string Chk_Perm2(string xPerm,string xSys,string xAct) 权限认证系列
邮件发送函数:
public void SendEmail(string xSubj,string xCont,string FmAddr,string ToAddr)
public void SendSmtp(string xSubj,string xCont,string xfrom,string xTo)
加密解密函数:
public static string Enc_PW(string xID,string xPW,int xLen) 改装sha1+md5加密解密函数加密函数
public static string Conv_10toXX(long xNum,int xBase) 10进 ......
常用函数系列:
public static string Get_ClientIP() 得到客户端IP
public static string Get_CMac(string IP) 得到客户端 CMac 地址
public static string RequestF(string xPName,string xPType,int xLenDef) 安全接收数据系列
public static string Show_Cont(string xStr) 过滤显示字串
public static string Show_jsStr(string xStr) 过滤显示js
安全检测函数:
public static string CheckUrl(string xDirPage) 上页地址认证
public static string Chk_Perm0(string xPerm,string xSys,string xAct) 权限认证系列
public static string Chk_Perm1(string xPerm,string xSys,string xAct) 权限认证系列
public static string Chk_Perm2(string xPerm,string xSys,string xAct) 权限认证系列
邮件发送函数:
public void SendEmail(string xSubj,string xCont,string FmAddr,string ToAddr)
public void SendSmtp(string xSubj,string xCont,string xfrom,string xTo)
加密解密函数:
public static string Enc_PW(string xID,string xPW,int xLen) 改装sha1+md5加密解密函数加密函数
public static string Conv_10toXX(long xNum,int xBase) 10进 ......
为什么要状态管理
B/S与C/S两种架构的有着完全不同的运行机制。C/S基本上所有的软件功能都在客户端(Client)中实现(所以C/S也称为胖客户端架构),服务器端(Server)只提供基础服务,最为典型的是数据库服务提供数据服务。而B/S架构主要的功能在服务端(Server)实现,客户端的浏览器(Browser)只接受用户输入和数据展现。C/S架构的功能都在客户端的一个进程中完成,客户端与服务器端的连接基本上保持同步,只需要记录两者的连接状态而不存在其他的状态要管理。
而在B/S架构中,客户端和服务之间的连接并不保持同步。我们来看看B/S架构客户端与服务器端的交互方式。客户端浏览器每次将网页发送到服务器时,服务器都会创建网页类的一个新的实例。在传统的Web编程中(指那些没有提供内置的状态管理机制的B/S开发平台),这通常意味着在每一次往返过程中,与该页及该页上的控件相关联的信息都会丢失。如用户将信息输入到页面的文本框中,该信息从浏览器传到服务器的往返过程中将丢失,所以状态管理机制成为B/S架构的一个重点。如果我们要深入学习B/S结构,研究其状态管理机制成为必经之路而无法逾越,本文就来探讨� ......
转:http://www.cnblogs.com/xiaozhuang/archive/2008/08/15/1268907.html
这几天园子里关于软件架构的讨论还是相当激烈,大家都想要一种能最大限度的降低各层之间依赖关系的的架构来适应变化的需求,谁都不喜欢改一点而动全身,尽量降低各层的改动产生的相互影响。
本篇我以理论和实践(源代码)两个方面和大家探讨一下我的方案,希望大家多提宝贵意见。
一、软件架构的概念问题,什么是软件的架构?我的理解是:软件的架构包括两个方面的内容,一个是软件的开发架构,一个是软件的部署架构,所谓部署架构就是指部署时的分布式,集群等设计问题;开发架构就是我们平常说的软件分层设计问题,也就是我们今天要谈的问题。
二、何谓分层?分层的方式有几种?分层也就是把一个大的软件解决方案分成多个项目进行开发,分为三种,一种是按照代码的功能层次进行分层,分为数据库访问层,业务逻辑层,UI层等,一种是按照要实现的功能模块进行分层,例如新闻管理层,博客管理层等,第三种就是把前两者结合起来进行分层:先按照代码功能划分好层次,然后再在每一层中分层成各个功能模块。
三、面向接口能够降低各层之间的依赖关系吗?还需要什么?面向接口只是把对对象的直� ......
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace ="System.Text" %>
<%@ Import Namespace="System.Data" %>
<%
for (int i = 0; i <= 10; i++)
{
int j=0;
j += i;
j++;
Response.Write(j+"<br/>");
}
%>
<% Response.Write("花花"); %>
<%
%>
这样写起来很方便 ......
Asp.net 中在客户端触发服务器端事件分为两种情况:
一. WebControls中的Button 和HtmlControls中的Type为submit的HtmlInputButton
这两种按钮最终到客户端的表现形式为:<input type="submit" value="Submit">,这是Form表单的提交按钮,点击以后会作为参数发送到服务端,参数是这样的:
控件的name属性=控件的value值,对应上面的例子就是:Submit1= Submit。服务器端会根据接收到的控件的name属性的这个key来得知是这个按钮被点击了,从而在服务端触发这个按钮的点击事件。
二. HtmlControls 中的 Type为button的HtmlInputButton 和其它所有的控件事件,比如LinkButton点击,TextBox的Change事件等等:
这些事件在客户端产生后会经过一个统一的机制发送到服务端。
1.首先asp.net页框架会使用两个Hidden域来存放表示是哪个控件触发的事件,以及事件的参数:
<!―表示触发事件的控件,一般是这个控件的name -->
<input type="hidden" value="" />
<!―表示触发事件的参数,一般是当某个控件有两个以上的事件时,用来区别是哪个事件 -->
<input type="hidden" value="" />
2.服务端会生成一个jscrip ......