多个提交按钮和 css tabpanel
我有一个 ASP.NET Ajax Web 查询表单,它由 4 个选项卡面板组成。
每个面板都有自己的文本框和提交按钮,以便它可以对数据库执行特定的查询。
例如,一个按月份搜索数据,另一个按名称搜索数据...
当表单仅包含一个提交按钮时,如果用户在文本框中按 Enter 键,则会触发回发,一切正常。
但是,当有多个提交按钮时,我如何控制哪个按钮处于“打开”状态以及要考虑哪个文本框。
我的意思是,当用户单击实际的“提交”按钮时,一切都很好(再次!)。 但 Enter 键会使页面混乱。
理想情况下,我想向每个按钮添加一个 CSS 类,当显示特定面板时,该类将通过 javascript 全局变量设置为“活动”。
有更好的办法吗? 有工作样本吗?
I have a ASP.NET Ajax web query form which is made of 4 tab panels.
Each of these panels have its own textbox and Submit button so that it can perform a particular query against the database.
E.g. one is searching data by Month, another by Name...
When a form only contains ONE submit button, if user hit the Enter key from within the textbox, the postback is fired and all is well.
But when there are multiple submit buttons, how can I control which one is "On" and which textbox is to be taken in account.
I mean when user click on the actual Submit button all is fine (again!).
But Enter key confuses the page.
Ideally, I would like to add a CSS class to each button, and when a particular panel is on display, this class will be set "active" by means of javascript global variable.
Is there a better way?
Does one have any working sample?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
加载时,尝试将提交按钮的 Enabled 属性设置为等于面板的 Visibility 属性。
这样一次只能启用一个按钮。
On load, try setting the Submit Button's Enabled property equal to the Panel's Visibility property.
That way only one button at a time is enabled.