简体   繁体   English

如何将ASP Web用户控件中的表单控件与页面的其余表单控件隔离开?

[英]How can I isolate the form controls in a ASP Web User Control from the rest of the page's form controls?

I have a Web User Control I created for authentication. 我有一个为身份验证创建的Web用户控件。 The web user control is inside the box below. Web用户控件在下面的框中。 Clicking any button (1 or 2) below works correct as it goes to the correct c# button click event in the code behind file. 单击下面的任何按钮(1或2)都可以正常工作,因为它可以处理文件后面代码中正确的c#按钮单击事件。 If I press enter on fields a or b it goes to the correct callback (button1's) if I press enter on field c it still goes to button1's callback, not button2's 如果我在字段a或b上按回车,它将转到正确的回调(button1的);如果我在字段c上按Enter,它仍将转到button1的回调,而不是button2的

How can I give my web user control a nice self contained for and view state etc, so it wont mess with the remainder of the page's form? 我如何让我的Web用户控件具有良好的自我包含和查看状态等信息,从而不会与页面表单的其余部分混淆?

+--------------+
 | User: __a___ |
 | Pass: __b___ |
 |     [button1]|
 +--------------+

 Prompt:______c______ [button2]

You can use a Panel and set the default acceptbutton. 您可以使用面板并设置默认的接受按钮。

Example here 这里的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM