单击按钮时无法分配验证组。
<asp:TabPanel ID="tabpnlTwo" runat="server" Visible="false" Width="100%" OnClientClick="radiobuttonvalidationForTabOne">
<ContentTemplate>
</ContentTemplate>
<asp:TabPanel ID="tabpnlTwo" runat="server" Visible="false" Width="100%" OnClientClick="radiobuttonvalidationForTabTwo">
<ContentTemplate>
</ContentTemplate>
在 tabpnanel 调用脚本函数 onClientClick 此处将验证组分配给按钮
<script>
function radiobuttonvalidationForTabOne() {
var btnAddOrderId = document.getElementById("btnAddToOrder");
btnAddOrderId.ValidationGroup = "tabpnlOneGroup";
alert(btnAddOrderId.ValidationGroup);
}
</script>
<script>
function radiobuttonvalidationForTabTwo() {
var btnAddOrderId = document.getElementById("btnAddToOrder");
btnAddOrderId.ValidationGroup = "tabpnlTwoGroup";
alert(btnAddOrderId.ValidationGroup);
}
</script>
<asp:Button ID="btnAddToOrder" CssClass="customButton" runat="server" Text="Add To Order" ValidationGroup="tabpnlOneGroup"
onclick="btnAddToOrder_Click" />