处理asp.net的回车事件
1.添加js函数
function TextBoxEntered(buttton) {
if (event.which || event.keyCode) {
if ((event.which == 13) || (event.keyCode == 13)) {
document.getElementById(button).click();
return false;
}
}
else { return true; }
}
此函数能让文本框的回车事件转换为一个隐藏按钮的点击事件。
2.绑定onkeydown事件的处理函数
TextBoxX.Attributes.Add("onkeydown", "TextBoxEntered('" + ButtonX.ClientID + "')"); (.cs)
or
onkeydown = "TextBoxEntered('<%=ButtonX.ClientID%>')" (.aspx)
相关文档:
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.Specialized;
4 using System.Linq;
5 using System.Web;
6 using System.Text;
7 u ......
介绍
缓存是在内存存储数据的一项技术,也是ASP.NET中提供的重要特性之一。例如你可以在复杂查询的时候缓存数据,这样后来的请求就不需要从数据库中取数据,而是直接从缓存中获取。通过使用缓存可以提高应用程序的性能。
主要有两种类型的缓存:
1.输出缓存Output caching
2.数据缓存Data caching
1. 输出缓存(Output ......
1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Att ......
一,如果直接把asp.net mvc2 RC 部署在iis5.1上,会出现无法显示页面的情况,原因可能是路径映射没有起作用。
解决办法:
1.在 routes.MapRoute(
"Default", ......
using System.Web;
/// <summary>
/// Javascript常用方法
/// </summary>
public class JS
{
private static string ScriptStart = "<script type=\"text/javascript\">";
private static string ScriptEnd = "</script>";
&n ......