1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
<asp:CommandField ShowEditButton="True" />
<asp:TemplateField HeaderText="No ID" SortExpression="id">
<ItemTemplate>
<asp:Label ID="diplomeID" runat="server" Text='<%# Bind("id") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="AjoutDip" Text="Ajouter" ValidationGroup="Ajout"
runat="server" onclick="InsertDip" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Libellé" SortExpression="libelle">
<ItemTemplate>
<asp:Label ID="Libel" runat="server" Text='<%# Bind("libelle") %>'></asp:Label>
</ItemTemplate>
<FooterTemplate>
<asp:TextBox ID="NewLibelle" ValidationGroup="Ajout" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorNewLib" ValidationGroup="Ajout"
runat="server" ControlToValidate="NewLibelle" Display="Dynamic"
ForeColor="Red" ErrorMessage="Le libellé est obligatoire.">
* </asp:RequiredFieldValidator>
</FooterTemplate>
<FooterStyle Wrap="false" />
</asp:TemplateField>
...
<asp:SqlDataSource ID="SqlDataSourceDip" Runat="server"
SelectCommand="SELECT [id], [libelle], [libellelong] FROM [diplome]"
InsertCommand="INSERT into diplome (libelle, libellelong) values (@NewLibelle, @NewLibellelong)"
UpdateCommand="UPDATE [diplome] SET [libelle] = @libelle, [libellelong] = @libellelong WHERE [id] = @id"
DeleteCommand="DELETE from diplome where Id = @Id"
...
<InsertParameters>
<asp:Parameter Name="NewLibelle"/>
<asp:Parameter Name="NewLibellelong"/>
</InsertParameters>
<DeleteParameters>
<asp:Parameter Name="diplomeID" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="libelle"/>
<asp:Parameter Name="id" />
</UpdateParameters>
... |
Partager