liuzemin

随笔分类 -  ASP.NET

截取过长的字段
摘要:///<summary>///将指定字符串按指定长度进行剪切,///</summary>///<paramname="oldStr">需要截断的字符串</param>///<paramname="maxLength">字符串的最大长度</param>///<paramname="endWith">超过长度的后缀</param>///<returns>如果超过长度,返回截断后的新字符串加上后缀,否则,返回原字符串</retu 阅读全文

posted @ 2012-02-23 00:52 liuzemin 阅读(262) 评论(0) 推荐(0)

ASP.NET数据库连接字符串写在config.web配置文件中(2)
摘要:1 在web.config中添加配置信息 2 添加引用 引用程序集添加引用->选.Net下的->System.configuration 导入命名空间System.Configuration 3 获取连接字符串 public static string GetConStr() { //读取配置文件的字符串 ConnectionStringSetting setting = Confi... 阅读全文

posted @ 2009-03-26 00:15 liuzemin 阅读(1837) 评论(1) 推荐(1)

ASP.NET验证码制作
摘要:1 添加一个验证码类,类里面写一个创建随机字符的方法 1 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->namespace Message.BLL { /// /// 验证码类 /// public clas... 阅读全文

posted @ 2009-03-25 12:54 liuzemin 阅读(231) 评论(0) 推荐(0)

ASP.NET数据库连接字符串写在config.web配置文件中(1)
摘要:1 在web.config的conafiguration里面添加 2 新建类库Data.cs里面的SqlConString静态私有属性读取配置文件 using System.Configuration; public class Data { private Data() { } ... 阅读全文

posted @ 2009-03-24 23:12 liuzemin 阅读(357) 评论(0) 推荐(0)

Repeater控件中点击按钮后获取某一行的数据
摘要:其实和GridView差不多的,如果模板中是有按钮之类的可以设置CommandName值的,可直接在ItemCommand事件中获取CommandName或者CommandArgument, 如果是模板中有文本框之类的,把文件框的AutoPostBack属性设置为True,然后在TextChanged事件中编写如下代码: //可以这样访问TextBox Code Code h... 阅读全文

posted @ 2009-03-08 22:16 liuzemin 阅读(799) 评论(0) 推荐(0)

后置代码中获取前台SqlDataSource1控件生成的数据
摘要:示例代码: DataView data = (DataView) SqlDataSource1.Select(new DataSourceSelectArguments()); data.RowFilter = "Id=876"; gvtest.DataSource = data; gvtest.DataBind(); 使用前注意导入System.Data命名空... 阅读全文

posted @ 2009-03-08 22:15 liuzemin 阅读(341) 评论(0) 推荐(0)

C#2.0中 GridView日期列使用DataFormatString="{0:d}"
摘要:GridView日期列使用DataFormatString="{0:d}",没有任何变化?依然显示“2006-3-30 0:00:00” 没有变化 应该加上 HtmlEncode="false" ,DataFormatString的设置才会生效。 阅读全文

posted @ 2009-03-08 22:09 liuzemin 阅读(440) 评论(0) 推荐(0)

.NET在后置代码中输入JS提示语句(背景不会变白)!
摘要:Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", ""); 阅读全文

posted @ 2009-03-08 22:07 liuzemin 阅读(138) 评论(0) 推荐(0)

asp.net获取存储过程的输出参数
摘要:一、假设存储过程如下 --region [dbo].[InsertArchive] ------------------------------------------------------------------------------------------------------------------------ -- Generated By: wangzeng using ... 阅读全文

posted @ 2009-03-08 22:05 liuzemin 阅读(326) 评论(0) 推荐(0)

.net前台判断一个字段的数据是否为空
摘要: 阅读全文

posted @ 2009-03-08 22:03 liuzemin 阅读(438) 评论(0) 推荐(0)

读取数据库连接字符串
摘要:Web.Config中读取数据库连接字符串: string conn = System.Web.Configuration.WebConfigurationManager.ConnectionStrings ["conn"].ToString(); 加密数据库连接字符串: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -pe... 阅读全文

posted @ 2009-03-08 21:57 liuzemin 阅读(276) 评论(0) 推荐(0)