文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 国产软件 | 国外软件 | 汉化补丁 | 设为首页 | 加入收藏
业界资讯 | 图形图像 | 操作系统 | 网络冲浪 | 工具软件 | 办公软件 | 媒体动画 | 精文荟萃 | 认证考试 | 网站建设 | 技术开发 | 专栏
当前位置:abcdown网络学院网络编程Asp.Netasp.net常用代码
精品广告
推荐TOP10
·ASP.NET 2.0 多文件上传小经验
·asp.net常用代码
·Asp.net cache 简述
·技巧实例:ASP.NET生成静态页面实现方法
·ASP.NET、JSP及PHP之间的抉择
·.net基础知识错误注意二十二点知识
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·.NET基础知识-什么是.NET
·初学C#+ASP.NET+Oracle时积累的备忘点滴
·专家详解:复杂表达式的执行步骤
阅读TOP10
·使用ASP.NET2.0的ReportViewer查看RDLC报表
·打造一个通用ASP.NET数据分页控件
·asp.net结合html,javascript实现无刷新跨域数据提交
·Asp.Net中使用水晶报表
·Asp.net cache 简述
·ASP.NET2.0下含有CheckBox的GridView删除选定记录实例
·用http代理下载sourceforge的cvs仓库[原理+C#代码]
·asp.net常用代码
·ASP.NET 2.0 多文件上传小经验
·利用.net反射动态调用指定程序集的中的方法

asp.net常用代码

日期:2008年9月5日 作者: 查看:[大字体 中字体 小字体]


}
双击表格打开新一页
if(e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
  {
string OrderItemID =e.item.cells[1].Text;
...
e.item.Attributes.Add("ondblclick", "open('../ShippedGrid.aspx?id=" + OrderItemID + "')");
}
★特别注意:【?id=】 处不能为 【?id =】

6.表格超连接列传递参数
<asp:HyperLinkColumn Target="_blank"  headertext="ID号" DataTextField="id" NavigateUrl="aaa.aspx?id='<%# DataBinder.Eval(Container.DataItem, "数据字段1")%>'  & name='<%# DataBinder.Eval(Container.DataItem, "数据字段2")%>' />


7.表格点击改变颜色
if (e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
{
  e.Item.Attributes.Add("onclick","this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';");
}


写在DataGrid的_ItemDataBound里
if (e.Item.ItemType == ListItemType.Item e.Item.ItemType == ListItemType.AlternatingItem)
{
  e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#99cc00';this.style.color='buttontext';
this.style.cursor='default';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='';this.style.color='';");
}

8.关于日期格式

日期格式设定
DataFormatString="{0:yyyy-MM-dd}"

我觉得应该在itembound事件中
e.items.cell["你的列"].text=DateTime.Parse(e.items.cell["你的列"].text.ToString("yyyy-MM-dd"))

9.获取错误信息并到指定页面
不要使用Response.Redirect,而应该使用Server.Transfer
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
  if (Server.GetLastError() is HttpUnhandledException)
      Server.Transfer("MyErrorPage.aspx");

//其余的非HttpUnhandledException异常交给ASP.NET自己处理就okay了 :)
}

Redirect会导致post-back的产生从而丢失了错误信息,所以页面导向应该直接在服务器端执行,这样就可以在错误处理页
面得到出错信息并进行相应的处理


10.清空Cookie
Cookie.Expires=[DateTime];
Response.Cookies("UserName").Expires = 0


11.自定义异常处理

//自定义异常处理类

上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页 

上一篇:用post方法从网上抓取信息

下一篇:利用css和js实现firefox和IE都支持的页面局部打印


相关软件: 相关文章:
·网页播放器代码全集及详细说明[精]
·教你学习如何破解XP登陆密码
·QQ密码破解器
·中国地区三级联动下拉菜单代码和示例(附带代码下载)
·盗QQ密码高手FalseQQ
·再现C#导出Excel源码
·不用QQ密码查看聊天记录

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.abcdown.net
首页 | 本站声明 | 下载帮助 | 发布软件 |
中文版权所有:ABC学院 浙ICP备05000717号