鬼鬼DH

导航

 
A标记去掉下划线:style=' text-decoration:none'

datalist的ItemDataBound事件:所在   if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem){}里面,取字段方式例子:DataBinder.Eval(e.Item.DataItem, "id")


gridview的_RowDataBound在:if (e.Row.RowType == DataControlRowType.DataRow)   {},字段取方法:
DataBinder.Eval(e.Row.DataItem, "id")

【转帖】Asp.net让某一页的requestEncoding设置成gb2312或utf-8的方法

我的xpshop商城系统集成论坛,一定要用到utf-8格式,在web.config里面设置
<globalization
            requestEncoding="utf-8"
            responseEncoding="utf-8"
            fileEncoding="utf-8"
   />

但是腾讯财付通的即时到帐在线支付方式只支持gb2312格式传送数据,这就需要单独给支付页面设置gb2312编码格式
方法是:
在webconfig文件configuration元素下配置以下字节,path 可以目录路径,也可以单独指向某个文件..
<location path="Store/Pay.aspx">
      <system.web>
          <globalization fileEncoding="gb2312" requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN"/>
      </system.web>
</location

使用datalist的command事件的时候,在Pageload事件必须要设定只第一次绑定 否则会有验证的错误异常,即 if (!IsPostBack)····


两数据表某行数据的复制操作:(实例)
update szk
set 班级编号=
(select 班级编号 from Sheet1 where szk.考生号=Sheet1.考生号)


  public static string NoHTML(string Htmlstring)
        {
            //删除脚本
            Htmlstring = Htmlstring.Replace("\r\n", "");
            Htmlstring = Regex.Replace(Htmlstring, @"<script.*?</script>", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<style.*?</style>", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<.*?>", "", RegexOptions.IgnoreCase);
            //删除HTML
            Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", "", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
            Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
            Htmlstring = Htmlstring.Replace("<", "");
            Htmlstring = Htmlstring.Replace(">", "");
            Htmlstring = Htmlstring.Replace("\r\n", "");
            Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
            return Htmlstring;
        }

posted on 2009-08-15 19:01  鬼鬼DH  阅读(328)  评论(0编辑  收藏  举报