Inquiridor
RequiredFieldValidator em um TabContainer

Pergunta
-
Alguém poderia recomendar como utilizar o RequiredFieldValidator em um TabContainer? Eu fiz as associações dos campos e no ValidationGroup denominei para o TabIndex0 a letra A, no TabIndex1 a letra B e no TabIndex2 a letra C. No Botão Gravar no ValidationGroup coloquei A,B,C, mas esse procedimento não está dando certo.
Todas as Respostas
-
-
Rodrigo, na view TabContainer ID="vwPessoaJuridica" eu tirei os Requiered, mas eu tinha como ValidatorGroup=B.
No código VB do botão gravar:
Protected Sub btnGravar_Click(sender As Object, e As EventArgs) Handles btnGravar.Click
If Me.IsValid() Then
If modo.Text = "A" Then
alterar()
desabilita()
modo.Text = ""
End If
If modo.Text = "I" Then
inserir()
desabilita()
End If
End If
If modo.Text = "E" Then
excluir()
desabilita()
End If
modo.Text = "X"
End SubNo mais um trecho html:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CADASTRO.aspx.vb" Inherits="BRA_SI.CADASTRO" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register src="WebUserControlSImenu.ascx" tagname="WebUserControlSImenu" tagprefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:Panel ID="Panel1" runat="server" Width="950px">
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
</asp:UpdatePanel>
</asp:Panel>
<br />
<asp:Panel ID="Panel2" runat="server" GroupingText="CADASTRO" Width="950px"
style="text-align: left; color: #000000;" Height="104px"
HorizontalAlign="Right" BackColor="#CCCCCC">
<table class="style22" frame="border">
<tr>
<td style="text-align: center; background-color: #CCFFFF;">
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<asp:RadioButtonList ID="rblCategoriaCadastro" runat="server"
AppendDataBoundItems="True" AutoPostBack="True" BackColor="#CCFFFF"
Font-Size="Larger" RepeatDirection="Horizontal"
ToolTip="Escolha uma opção para cadastro." Width="928px">
</asp:RadioButtonList>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td style="text-align: center; background-color: #CCFFFF;">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table class="style22">
<tr>
<td style="text-align: left">
<asp:Button ID="btnInserir" runat="server" Height="30px"
style="font-style: italic;" Text="Inserir"
ToolTip="Clique para inserir novo registro" Width="70px" />
<asp:Button ID="btnAlterar" runat="server" Height="30px"
style="font-style: italic;" Text="Alterar"
ToolTip="Clique para alterar ou complementar registro existente."
Width="70px" />
<asp:Button ID="btnExcluir" runat="server" Height="30px"
style="font-style: italic;" Text="Excluir"
ToolTip="Clique para excluir um registro." Width="70px" />
</td>
<td style="text-align: left">
<asp:Button ID="btnGravar" runat="server" Height="30px"
style="font-style: italic;" Text="Gravar"
ToolTip="Clique para gravar as inserções, alterações ou exclusões."
Width="70px" ValidationGroup="A" />
<asp:Button ID="btnCancelar" runat="server" Height="30px"
style="font-style: italic;" Text="Cancelar"
ToolTip="Clique para cancelar sua operação." Width="70px" />
</td>
<td style="text-align: right">
<asp:TextBox ID="txtPesquisa" runat="server" BackColor="#F4F4F4"
style="margin-right: 0px" ToolTip="Digite as letras iniciais para pesquisa."
Width="280px"></asp:TextBox>
<asp:Button ID="btnPesquisar" runat="server" Height="30px"
style="font-style: italic;" Text="Pesquisar"
ToolTip="Clique para pesquisar seus registros." Width="75px" />
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
</table>
</asp:Panel>
<br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:MultiView ID="mtvCadastro" runat="server">
<asp:View ID="vwEndereco" runat="server">
<asp:Panel ID="Panel3" runat="server" BackColor="Silver"
GroupingText="ENDEREÇO" Height="806px" Width="950px">
<table class="style1" frame="border">
<tr>
<td class="style64" colspan="3">
</td>
</tr>
<tr>
<td class="style67" style="text-align: left; vertical-align: top;">
Tipo:<asp:RadioButtonList ID="rblTipo" runat="server" BackColor="White"
Font-Size="Small" RepeatColumns="3" style="color: #333333" Width="285px">
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ControlToValidate="rblTipo" EnableTheming="True" ForeColor="Red"
ValidationGroup="A" ErrorMessage="Tipo">*</asp:RequiredFieldValidator>
</td>
</table>
</asp:Panel>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</asp:View>
<asp:View ID="View6" runat="server">
</asp:View>
<asp:View ID="View7" runat="server">
</asp:View>
<asp:View ID="View8" runat="server">
</asp:View>
</asp:MultiView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rblCategoriaCadastro" />
</Triggers>
</asp:UpdatePanel>
</div>
</center>
</form>
</body>
</html>