面页机制采用ajax
index.aspx加载用户自定义控件login.ascxlogin.ascx简要代码如下; 用户名:
<asp:TextBox ID="name" runat="server" Width="120px" ></asp:TextBox><br/>
密码:
<asp:TextBox ID="pass" runat="server" TextMode="Password" Width="120px" ></asp:TextBox><br/>
<input id="Button1" type="button" value="登录" language="javascript" OnClick="return login(document.getElementById('name').value,document.getElementById('pass').value)" tabindex="0" atomicselection="false" />登录按钮不能换成:<asp:Button ID="Button2" runat="server" Style="position: relative" Text="Button" />
否则无法实现ajax的其他功能并且不能在index.aspx.cs中以登录控件的ID作为判断依据,因为那样会提示找不到指定控件之类的错误,也不能在login.ascx.cs中判断,那样也会出错请高手帮忙,谢谢了,送上分了
index.aspx加载用户自定义控件login.ascxlogin.ascx简要代码如下; 用户名:
<asp:TextBox ID="name" runat="server" Width="120px" ></asp:TextBox><br/>
密码:
<asp:TextBox ID="pass" runat="server" TextMode="Password" Width="120px" ></asp:TextBox><br/>
<input id="Button1" type="button" value="登录" language="javascript" OnClick="return login(document.getElementById('name').value,document.getElementById('pass').value)" tabindex="0" atomicselection="false" />登录按钮不能换成:<asp:Button ID="Button2" runat="server" Style="position: relative" Text="Button" />
否则无法实现ajax的其他功能并且不能在index.aspx.cs中以登录控件的ID作为判断依据,因为那样会提示找不到指定控件之类的错误,也不能在login.ascx.cs中判断,那样也会出错请高手帮忙,谢谢了,送上分了
解决方案 »
- (我的代码错在哪)输出出现次数最多的字母,请问怎样保证输入相同最多(aabb)时,结果输出a2b2而不是输出一个?
- 用vs2008安装部署做的移除移不乾净??
- C#调用C++的dll老报错: Attempted to read or write protected memory.
- 高手请进,DataGridViewCellStyle的默认值
- 谁来帮我看看啊!我把EXCEL导入到DATAVIEW中第一行老是不显示.
- c#中当控件的数量巨多的时,刷新慢如何解决?
- 用C#写OWC的PivotTable的问题
- 请教一个关于文档转换为XML的问题
- 操作网络打印机
- 有誰只用c#(或vs.net)進行asp.net(or B/S)開發的嗎
- 挑战WinForm底层开发极限 超级大难题 关于WindowsXP登录问题 所有朋友都可以来看看 恭请您的方案或直接codes 十万火谢!!!
- c#中List问题(在线等待)
在login.ascx页面的form属性 defaultButton 赋值为 "Button1"
2.<body OnLoad=Check();">
function Check()
{
Button1.focus();
}注意,必须要设置TABINDEX属性,否则不起作用
呵呵
都是不错的选择啊
var keycode = event.keyCode;
if(keycode == 13)
{
document.getElementsById("Button1").Click();
}
}
PS:这里的Button1 有可能会根据你的用户控件的名字变化,可以更改为运行后的名称
function txtSearch_onkeydown()
{
if (event.keyCode == 13)
{
//alert("ok");
SearchList();
return false;
}
return true;
}
c#代码如下: //按回车键跳转事件
#region 按回车键跳转事件
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
textBox2.Focus();
}
} private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
button1.Focus();
}
}
#endregion以上是我的代码,应该可以给你一点借鉴!
有个用户自定义控件的使用啊,登录按钮在登录控件里,怎么办啊,怎么办啊,登录按钮还是input的,怎么办啊
<input type="submit" ...