Sorry for "small" but may page is quiet big :
aspx page :
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Membre.aspx.vb"
Inherits="Membre" %>
<h1 id="oTFiche" runat="server">Fiche</h1>
<h2 id="oTMode" runat="server">Modification</h2>
<table>
<tr>
<td width="160"></td>
<td><asp:validationsummary id="oVS" DisplayMode="List"
Runat="server"></asp:validationsummary></td>
</tr>
<tr>
<td>Nom</td>
<td><asp:textbox id="oNom" Runat="server"
Width="200px"></asp:textbox><asp:requiredfieldvalidator id="oRFVNom"
Runat="server" text="&#9668;" ErrorMessage="Le nom est manquant."
ControlToValidate="oNom"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td>Prénom</td>
<td><asp:textbox id="oPrenom" Runat="server"
Width="200px"></asp:textbox><asp:requiredfieldvalidator id="oRFVPrenom"
Runat="server" text="&#9668;" ErrorMessage="Le prénom est manquant."
ControlToValidate="oPrenom"></asp:requiredfieldvalidator></td>
</tr>
<tr>
<td>Sexe</td>
<td><asp:dropdownlist id="oSexe" Runat="server"></asp:dropdownlist></td>
</tr>
<tr>
<td>Adresse</td>
<td><asp:textbox id="oAdresse" Runat="server"
Width="254px"></asp:textbox></td>
</tr>
<tr>
<td>C.P. & Localité</td>
<td><asp:textbox id="oCP" Runat="server"
Width="50px"></asp:textbox> <asp:textbox id="oLoc" Runat="server"
Width="200px"></asp:textbox></td>
</tr>
<tr>
<td>Téléphone</td>
<td><asp:textbox id="oTel" Runat="server"
Width="150px"></asp:textbox></td>
</tr>
<tr>
<td>EMail</td>
<td><asp:textbox id="oEMail" Runat="server"
Width="400px"></asp:textbox></td>
</tr>
<tr>
<td>EMail parent</td>
<td><asp:textbox id="oEMailParent" Runat="server"
Width="400px"></asp:textbox></td>
</tr>
<tr id="oTRType" visible="False" runat="server">
<td>Type</td>
<td>
<script language="javascript">
function ChangeType() {
document.all("oSection").disabled = event.srcElement.value > 3;
}
</script>
<asp

ropDownList ID="oType" DataTextField="Type_Nom"
DataValueField="Type_Id" onchange="javascript:ChangeType();"
Runat="server" /></td>
</tr>
<tr id="oTRSection" visible="False" runat="server">
<td>Section</td>
<td><asp

ropDownList ID="oSection" DataTextField="Anim_Nom"
DataValueField="Anim_Id" Runat="server" /></td>
</tr>
<tr id="oTRTotem" runat="server">
<td>Totem</td>
<td><asp:TextBox ID="oTotem" Width="200px" Runat="server" /></td>
</tr>
<tr>
<td>Naissance (jj/mm/aa)</td>
<td><asp:TextBox ID="oNaissance" Width="80px" Runat="server"
/><asp:CustomValidator ID="oCVNaissance" EnableClientScript="False"
ErrorMessage="La date de naissance est incorrecte."
OnServerValidate="CtrlNaissance" text="&#9668;" Runat="server"
/></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td></td>
<td><asp:Button ID="oOK" CommandName="=" OnCommand="Action"
Text="Enregistrer" Width="100px" Runat="server" />
<asp:Button ID="oKO" CausesValidation="False" CommandName="0"
OnCommand="Action" Text="Annuler"
Width="100px" Runat="server" /></td>
</tr>
</table>
<asp:Literal ID="oScript" EnableViewState="False" Runat="server" />
and code behind page :
Imports System.Web.UI.WebControls
Public Class Membre
Inherits PageGestion
Protected WithEvents oNom As System.Web.UI.WebControls.TextBox
Protected WithEvents oPrenom As System.Web.UI.WebControls.TextBox
Protected WithEvents oSexe As System.Web.UI.WebControls.DropDownList
Protected WithEvents oAdresse As System.Web.UI.WebControls.TextBox
Protected WithEvents oCP As System.Web.UI.WebControls.TextBox
Protected WithEvents oLoc As System.Web.UI.WebControls.TextBox
Protected WithEvents oTel As System.Web.UI.WebControls.TextBox
Protected WithEvents oEMail As System.Web.UI.WebControls.TextBox
Protected WithEvents oOK As System.Web.UI.WebControls.Button
Protected WithEvents oKO As System.Web.UI.WebControls.Button
Protected WithEvents oTotem As System.Web.UI.WebControls.TextBox
Protected WithEvents oVS As System.Web.UI.WebControls.ValidationSummary
Protected WithEvents oRFVNom As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents oRFVPrenom As
System.Web.UI.WebControls.RequiredFieldValidator
Protected WithEvents oNaissance As System.Web.UI.WebControls.TextBox
Protected WithEvents oCVNaissance As
System.Web.UI.WebControls.CustomValidator
Protected WithEvents oTFiche As
System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents oTMode As
System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents oTRTotem As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents oEMailParent As System.Web.UI.WebControls.TextBox
Protected WithEvents oType As System.Web.UI.WebControls.DropDownList
Protected WithEvents oSection As System.Web.UI.WebControls.DropDownList
Protected WithEvents oTRType As System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents oTRSection As
System.Web.UI.HtmlControls.HtmlTableRow
Protected WithEvents oScript As System.Web.UI.WebControls.Literal
Private lNouveau As Boolean
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
lNouveau = (Request.QueryString("IdMbr") = "")
If Not IsPostBack Then
If lNouveau Then
If Niveau < 3 Then
Response.Redirect("/Gestion")
End If
Else
If BD.Requete("SELECT * FROM Membres WHERE Mbr_Id = " &
Request.QueryString("IdMbr"), "Membre").Rows.Count <> 1 Then
Response.Redirect("/Gestion")
End If
End If
End If
End Sub
Sub action(ByVal Source As Object, ByVal e As CommandEventArgs)
If e.CommandName = "=" Then
Page.Validate
If Not Page.IsValid Then
Exit Sub
End If
Dim oDate
If oNaissance.Text <> "" Then
oDate = CDate(oNaissance.Text)
End If
If BD.MAJ(lNouveau, _
"Membres", _
"Mbr_Id = " & Request.QueryString("IdMbr"), _
"Mbr_Nom·Mbr_Prenom·Mbr_Feminin·Mbr_Adresse·Mbr_CP·Mbr_Localite·Mbr_Telephon
e·Mbr_EMail·Mbr_EMailParent·Mbr_Totem·Mbr_Naissance" _
& IIf(lNouveau, "·Mbr_Type·Mbr_Animation", ""), _
oNom, _
oPrenom, _
oSexe.SelectedIndex, _
oAdresse, _
oCP, _
oLoc, _
oTel, _
oEMail, _
oEMailParent, _
oTotem, _
oDate, _
oType, _
IIf(Not lNouveau OrElse oType.SelectedItem.Value > 3,
"SQL:NULL", oSection)) _
AndAlso lNouveau Then
If oType.SelectedItem.Value < 4 Then
Response.Redirect("/Gestion/Membres.aspx" &
IIf(Request.QueryString("IdS") = "", "#" & BD.DernierId, "?IdS=" &
Request.QueryString("IdS")))
Else
Response.Redirect("/Gestion")
End If
End If
End If
Response.Redirect("/Gestion/Membres.aspx" _
& IIf(Request.QueryString("IdS") = "", "",
"?IdS=" & Request.QueryString("IdS")) _
& IIf(Not lNouveau, "#" &
Request.QueryString("IdMbr"), ""))
End Sub
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
If Not IsPostBack Then
With oSexe.Items
.Add("Masculin")
.Add("Féminin")
End With
Dim nSection, nType As Integer
If lNouveau Then
Dim cFiltre As String = "Type_Id < 4"
nType = 1
If Niveau = 3 Then
nSection = Animation
Else
If Val(Request.QueryString("IdS")) = 5 Then
cFiltre = "Type_Id > 1 AND Type_Id < 4"
nType = 2
nSection = 1
Else
nSection = Math.Max(Val(Request.QueryString("IdS")),
1)
End If
End If
BD.Requete("SELECT * FROM TypesMembre WHERE " & cFiltre & "
ORDER BY Type_Id", "", oType)
BD.Requete("SELECT * FROM TypesAnimation ORDER BY Anim_Id",
"", oSection)
SelectItem(oType, nType)
SelectItem(oSection, nSection)
oTMode.InnerText = "Création"
Else
With BD.DS.Tables("Membre").Rows(0)
nType = .Item("Mbr_Type")
nSection = .Item("Mbr_Animation")
oNom.Text = .Item("Mbr_Nom")
oPrenom.Text = .Item("Mbr_Prenom")
oSexe.SelectedIndex = IIf(.Item("Mbr_Feminin"), 1, 0)
oAdresse.Text = .Item("Mbr_Adresse").ToString
oCP.Text = .Item("Mbr_CP").ToString
oLoc.Text = .Item("Mbr_Localite").ToString
oTel.Text = .Item("Mbr_Telephone").ToString
oEMail.Text = .Item("Mbr_EMail").ToString
oEMailParent.Text = .Item("Mbr_EMailParent").ToString
oTotem.Text = .Item("Mbr_Totem").ToString
If Not IsDBNull(.Item("Mbr_Naissance")) Then
oNaissance.Text = Format(.Item("Mbr_Naissance"),
"dd/MM/yy")
End If
If (Niveau < 3 _
OrElse (Niveau = 3 _
AndAlso Animation <> nSection)) _
AndAlso IdGestion <> .Item("Mbr_Id") Then
oTMode.InnerText = "Consultation"
oNom.Enabled = False
oPrenom.Enabled = False
oSexe.Enabled = False
oAdresse.Enabled = False
oCP.Enabled = False
oLoc.Enabled = False
oTel.Enabled = False
oEMail.Enabled = False
oEMailParent.Enabled = False
oTotem.Enabled = False
oNaissance.Enabled = False
oOK.Visible = False
With oKO
.Text = "OK"
.Width = New Unit(50, UnitType.Pixel)
End With
End If
End With
End If
If nType = 6 _
OrElse (lNouveau _
AndAlso Niveau > 3 _
AndAlso Request.QueryString("IdS") = "") Then
oTFiche.InnerText &= " d'un membre"
Else
Select Case nType
Case 1
oTFiche.InnerText &= Choose(nSection, _
" d'un baladin", _
" d'un louveteau", _
" d'une scoute", _
" d'un scout")
If nSection < 3 Then
oTRTotem.Visible = False
End If
Case 2, 3
oTFiche.InnerText &= " d'un animateur"
Case 4, 5
oTFiche.InnerText &= " d'un membre de l'ASBL"
End Select
End If
End If
If lNouveau _
AndAlso Niveau > 3 _
AndAlso (Request.QueryString("IdS") = "" _
OrElse Request.QueryString("IdS") = "5") Then
oTRType.Visible = True
oTRSection.Visible = True
End If
If oNom.Enabled Then
oScript.Text = "<script language=""javascript"">with
(document.all('" & oNom.ClientID & "')) { select(); focus(); }</script>"
End If
End Sub
Sub CtrlNaissance(ByVal Source As Object, ByVal E As
ServerValidateEventArgs)
E.IsValid = oNaissance.Text = "" _
OrElse IsDate(oNaissance.Text)
End Sub
End Class
Thanks for help !