Asp.Net 默认按钮
方法一:
function document.onkeydown()
{
if(event.keyCode==13)
{
document.form1.all.Submit.click(); //这里的submit是按钮的ID
}
}
方法二:
<form id="form1" runat="server" defaultbutton="button1">
<div>
<asp:Panel DefaultButton="button1"></asp:Panel>
<asp:Button ID="button1" runat="server" Text="Button1" />
</div>
</form>
方法三:
在Page_Load中加入如下代码
TextBox.Attributs.Add("onkeydown","if(keyCode==13) {document.all.Button2.focus(); document.all.Button2.click();}");
方法四:
<form id="form1" runat="server" defaultbutton="Ok">
<!--设置form的属性 defaultbutton=“默认按钮ID” 这个是我在VS2005中式的-->
方法五:
2个以上的textbox,先判断焦点在选择对应的按钮
<script type="text/javascript">
function document.onkeydown()
{
if(event.keyCode==13)
{
if(document.activeElement.id == "Text1")
{
document.form1.all.Button1.click(); //这里的submit是按钮的ID
}
else if(document.activeElement.id == "Text2")
{
document.form1.all.Button2.click(); //这里的submit是按钮的ID
}
}
}
</script>
<input id="Text1" type="text" />
<input id="Button1" type="button" value="button" onclick="javascript:alert('Button1 is onclick!')" />
<br />
<input id="Text2" type="text" />
<input id="Button2" type
相关文档:
如果仅仅是上传一个文件,最好是使用FileUpload控件, 可以使用FileUpload1.FileContent.Length得到文件大小, FileUpload1.FileBytes得到其字节数组, 代码略.
如果要上传多个文件, 其客户端代码与使用ASP.NET上传多个文件到服务器基本相同, 本例中加入了下载的示例代码。
效果图如下:
数据库脚本
create data ......
在Email系统中经常会上传多个文件到服务器,用户大多习惯一次上传所有的文件,而不是逐个上传,我们可以使用javascript动态地添加file元素到表单,然后在服务器端处理这些file
效果图如下:
页面代码MutlileFileUpload.aspx如下:
view plaincopy to clipboardprint?
<%@ Page Language="C#" AutoEventWireup="true" C ......
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" & ......
原地址:
http://msdn.microsoft.com/en-us/library/aa480476.aspx
IIS Authentication
ASP.NET authentication is a two-step process. First, Internet Information Services (IIS) authenticates the user and creates a Windows token to represent the user. IIS determines the authentication mode that it shoul ......
一.使用QueryString
Request.QueryString
在ASP时代,这个是较常用的方法,到了ASP.NET,好像用的人不多了,但是不管怎么说,这是一个没有过时,且很值得推荐的方法,因为不管是ASP还是ASP.NET,最基本的都还是基于HTTp协议的。 缺点是非常明显的,让在多个页面传递时,可能就Request不到了
使用Qu ......