摘要: 有人问,既然RadioButtonList可以实现单选,哪么为什么还要用CheckBoxList实现单选呢?这样做除去费时以外好像没有什么“好处”;但是有时用RadioButtonList实现单选不太合适。例如:我是用户,我选择其中一项后,又不想选择其中一项怎么办?而且那个RadioButtonList怎么看都不顺眼,确实有点丑。好了废话不说了,实现CheckBoxList单选的代码如下: 方法1... 阅读全文
posted @ 2008-07-17 15:38 Shapley 阅读(1899) 评论(0) 推荐(0) 编辑
摘要: 动态创建asp.net控件并保存其状态,简要总结如下: 1:背景知识:需要了解Page的生存周期。 2:方法总结: 1> 在页面代码文件中的声明区域写(这里以Label控件为例): Label x = new Label(); pageload事件中代码为: protected void Page_Load(object sender, EventArgs e) { this.Page.C... 阅读全文
posted @ 2008-07-09 09:36 Shapley 阅读(844) 评论(0) 推荐(0) 编辑
摘要: 1,JavaScript设置链接不可用: ScriptManager.RegisterStartupScript(Page, typeof(Page), "", "", false); 阅读全文
posted @ 2008-07-03 08:59 Shapley 阅读(217) 评论(0) 推荐(0) 编辑
摘要: function CheckUpload() { var val = $("ctl00_ContentPlaceHolder1_FileUpload1").value; if(val == "") { alert("请选择上传附件。");return false; } ... 阅读全文
posted @ 2008-06-13 08:57 Shapley 阅读(1084) 评论(2) 推荐(0) 编辑
摘要: 1.符号“/”指程序运行所在根目录,即IIs所在目录。 如果iis所在目录为:d:\programs 解决方案为d:\programs\d 网站路径为:d:\programs\d\web\ 符号“/”代表的是:d:\programs,不管你的网站前面有多少级,都应该作为一个整体。 2.符号“~/”,则是指网站所在根目录。即d:\programs\d\web。 测试代码如下: protected ... 阅读全文
posted @ 2008-06-12 16:21 Shapley 阅读(1436) 评论(5) 推荐(0) 编辑
摘要: 以前老是忘记怎么 查找radiobuttonlist中项的个数,现在写下来,以防再次忘记。 var items = document.getElementsByName("ctl00$ContentPlaceHolder1$RadioButtonList1"); for (var i = 0; i < items.length; i++) { if (items[i].check... 阅读全文
posted @ 2008-06-12 14:54 Shapley 阅读(280) 评论(0) 推荐(0) 编辑
摘要: 一、DataBinder.Eval的基本格式 在绑定数据时经常会用到这个句程序: 或者 今天又学到一种,而且微软也说这种方法的效率要比以上两种高。 ... 阅读全文
posted @ 2008-05-29 09:41 Shapley 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 废话不说,具体代码如下: System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(); message.To.Add(this.txtAddress.Text); message.Subject = "This is the Subject line"; ... 阅读全文
posted @ 2008-03-18 09:59 Shapley 阅读(139) 评论(0) 推荐(0) 编辑
摘要: 1.运行脚本 ScriptManager.RegisterStartupScript(this.lblNewPage,this.GetType(),"aa","opener.focus();window.close();",true); Page.RegisterStartupScript(); ClientScript.RegisterStartupScript(this.GetType(), ... 阅读全文
posted @ 2008-03-14 10:49 Shapley 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 一,直接循环: function CheckDate() { var grid = document.getElementById("DataGrid1"); for (var i = 2;i < grid.rows.length +2; i++) { if (document.getElementById('DataGrid1__ctl'+i+'_CheckBox... 阅读全文
posted @ 2008-01-22 12:58 Shapley 阅读(268) 评论(0) 推荐(0) 编辑