处理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)
相关文档:
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<authorization>
< ......
分页代码如下(PageHelper.cs):
代码
1 using System;
2 using System.Collections.Generic;
3 using System.Collections.Specialized;
4 using System.Linq;
5 using System.Web;
......
一、ASP.NET Web Service代码
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
namespace WebService1
{
/// <sum ......
在GridView中我们可以直接添加一个CommandField删除列来删除某行信息。但为了避免误操作引起的误删除,在删除操作者让操作者再确认下,完后再进行删除。
首先我们给我们的GridView 添加一个模板列,如下:
以下是引用片段:
<ASP:TemplateField HeaderText="Delete" ShowHeader="False">
<ItemStyle ......