摘要: 原先使用母板页的时候都是在aspx页面前面加上一条编译指令 ,指定该页面的母板页是某某.其实我们也可以通过page 对象的MasterPageFile属性来指定具体使用的是哪个文件.这个指定过程一般放在page对象的PreInit事件中 例如: public class BasePage:Page { public BasePage() { PreInit += Set_MasterPage; } public void Set_MasterPage(object sender, EventArgs e) ... 阅读全文
posted @ 2012-01-31 15:28 水草肃 阅读(247) 评论(0) 推荐(0)
摘要: 看了这篇博文http://blog.zhaojie.me/2007/12/usercontrol-as-an-template.html做了个练习用户自定义控件生成代码1.我们需要一个一般处理程序 (ashx页面) 在这个页面中我们创建一个control 并为属性字段赋值2.将之前创建的contral 放到一个page对象的contrals集合中3.将页面请求转交给上面说过的page对象 主要是利用了 HttpContext.Current.Server.Execute方法下面附上代码(ashx)using System;using System.Collections.Generic;... 阅读全文
posted @ 2012-01-17 14:21 水草肃 阅读(168) 评论(0) 推荐(0)
摘要: DLTYiLou t = new DLTYiLou(); t.Calculate(); Type type = typeof(DLTYiLou); using (StreamWriter sw = new StreamWriter("dlt.txt")) { FieldInfo[] field = typeof(DLTYiLou).GetFields(); foreach (FieldInfo item in field) ... 阅读全文
posted @ 2012-01-16 14:49 水草肃 阅读(136) 评论(0) 推荐(0)
摘要: 主机对象是我们所必须的IPEndPoint套接字socket套接字绑定主机对象使用套件字开始监听socket.listen获取监听获得的套接字Socket b=socket.Accept();IPAddress myIP = IPAddress.Parse("127.0.0.1"); IPEndPoint myServer = new IPEndPoint(myIP, 2012); Socket mySocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolT... 阅读全文
posted @ 2012-01-16 10:41 水草肃 阅读(285) 评论(0) 推荐(0)
摘要: 下面介绍两种复制数据库表的方法 这可以用在备份表的时候1.在没有目标表的情况下使用 需要注意的是, 这种方法可以自动的创建表,但是不会创建主键. 例如 select 列 into 目标表名 from 源表名 select * into wx from zl2.在目标表已经存在的情况下使用 这种情况下目标表最好取消自动增长列的 自动增长 ,不会就引起错误. 例如 insert into 表(列) select (列) from 表 select into wx(w,x) select z,l from zl 阅读全文
posted @ 2012-01-05 13:35 水草肃 阅读(792) 评论(0) 推荐(0)
摘要: 直接给出小函数var Monery=function(mon){ var re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g; var tem=mon.replace(re,"$1,"); return tem.replace(".00",""); }参数为一个数字字符串 如456789.12 sqlsever 中的decimal 类行 阅读全文
posted @ 2011-12-14 15:18 水草肃 阅读(514) 评论(0) 推荐(0)
摘要: 近日 遇到一个js date 方面的问题 ;首先描述下问题 : 在做项目时,将后台的数据读取到datatable中然后通过一方法将datatable中的数据转换成json格式的字符串 返回给前端. 这个方法将所有的数据都转换成了字符串. date 格式的数据被转换成了"yyyy-mm-dd- hh:mm:ss"如 2011-11-11 11:11:11 这样的. 非常不幸date不接受这样的字符串进行构造. 所以有了下面的笨办法 .var ToDate=function(str){ var strtem=str.replace(/(\d{4})-(\d{1,2})-(... 阅读全文
posted @ 2011-12-14 15:05 水草肃 阅读(233) 评论(0) 推荐(0)
摘要: $.ajax()方法的参数为一个对象 这个对象可以是很复杂的不过实际使用时 不需要给定那么多的参数这里给出一个比较简单的但很实用的例子前台代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head> <title 阅读全文
posted @ 2011-12-14 14:38 水草肃 阅读(249) 评论(0) 推荐(0)
摘要: 前面创建了一个需要被请求的ashx页面下面创建一个异步请求的对具体页面 一般为今天的html 在js中通过 xmlhttprequest 对象 ,或者使用JQuery已经封装过的方法进行异步请求下面是最简单的一个例子<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/x 阅读全文
posted @ 2011-12-14 13:54 水草肃 阅读(297) 评论(0) 推荐(0)
摘要: 首先创建一般处理程序,也就是ashx 文件然后就是要让异步请求的数据不被浏览器缓存其次获得请求的参数再次根据参数进行具体的业务逻辑操作最后返回响应的字符串下面给出一个简单的例子using System;using System.Collections;using System.Data;using System.Linq;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;using System.Xml.Linq;namespace WXWebTest.AJAX{ /// <sum 阅读全文
posted @ 2011-12-14 12:41 水草肃 阅读(629) 评论(0) 推荐(0)