ValidatorCalloutExtender 包含 TabContainer/TabPanels?
我有一个带有三页输入字段的 TabContainer。对于每个 TabPanel,都有一组 ValidatorCalloutExtender(面板上的每个验证器都有一个)。
当我验证页面时,验证仅适用于当前面板。对于所有隐藏的选项卡面板,当选择该选项卡时,所有验证器工具提示都杂乱可见。
我在第一个和第二个选项卡页上放置了一个按钮,大致如下所示:
<input type="button" class="next" value="Next" onclick="Page_ClientValidate('Contact'); if(Page_IsValid) { SelectTab(1); }" />
其中 selecttab 如下所示:
function SelectTab(ix)
{
var container = $find('<%=createUserTabs.ClientID%>');
container.set_activeTabIndex(ix);
}
仅按按钮,选项卡页实际上会进行验证。 但当我点击选项卡而不是按钮时,地狱刹车再次松动。
首先,无法阻止选项卡切换。 其次,如果我向 OnClientActiveTabChanged="tabChanged" 添加验证,所有验证器都会在已验证的选项卡上堆得一团糟,因为它没有显示。
function tabChanged(sender, args) {
tabIndex = sender.get_activeTabIndex();
if (!Page_ClientValidate('Contacts')) {
if (tabIndex != 0) {
sender.set_activeTabIndex(0);
Page_ClientValidate('Contacts'); //Doesn't fix the validator soup
}
return;
}
有人让 ValidatorCalloutExtenders 与 TabContainer 一起使用吗?
是否值得为 ajaxControlToolkit 烦恼,还是应该不眨眼地重写为 jQuery? (严重的问题...这是一个 webforms 项目,如果 ajaxControlToolkit 正在使用,但我感觉受到它的限制和对抗。)
I have a TabContainer with three pages of input fields. For each TabPanel there's a set of ValidatorCalloutExtenders (one for every validator on the panel).
When I validate the page the validation only works as it should for the current panel. For all hidden TabPanels all the validator-tooltips are visible in a mess when that tab is selected.
I have put a button on the first and second tab pages that looks roughly like this:
<input type="button" class="next" value="Next" onclick="Page_ClientValidate('Contact'); if(Page_IsValid) { SelectTab(1); }" />
where selecttab looks like this:
function SelectTab(ix)
{
var container = $find('<%=createUserTabs.ClientID%>');
container.set_activeTabIndex(ix);
}
Pushing only the buttons, the tab pages actually work with the validation.
But when I click the tabs instead of buttons, hell brakes loose again.
First there are no way to prevent a tab switch.
Secondly if I add validation to OnClientActiveTabChanged="tabChanged" all the validators are piled up in a mess on the validated tab, as it's not displayed.
function tabChanged(sender, args) {
tabIndex = sender.get_activeTabIndex();
if (!Page_ClientValidate('Contacts')) {
if (tabIndex != 0) {
sender.set_activeTabIndex(0);
Page_ClientValidate('Contacts'); //Doesn't fix the validator soup
}
return;
}
Did anyone get ValidatorCalloutExtenders working with TabContainer?
Is it worth bothering with ajaxControlToolkit at all or should I rewrite to jQuery without blinking? (Serious question... This is a webforms project where a lot if ajaxControlToolkit is in use, but I'm feeling constrained and countered by it.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系……我太厚了。
Nevermind... I'm so thick.