la page aspx est:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="page1.aspx.vb" Inherits="page1" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.1, Version=9.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.1, Version=9.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.DynamicData" tagprefix="cc1" %>
<%@ Register assembly="DevExpress.Web.v9.1, Version=9.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>
<%@ Register assembly="DevExpress.Web.ASPxScheduler.v9.1, Version=9.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxScheduler" tagprefix="dxwschs" %>
<%@ Register assembly="System.Web.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<%@ Register assembly="DevExpress.Web.v9.1, Version=9.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxDataView" tagprefix="dxdv" %>
<!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">
<head runat="server">
<title></title>
<style type="text/css">
#form1
{
height: 639px;
width: 1014px;
margin-right: 285px;
}
.style3
{
width: 32px;
}
.style8
{
width: 32px;
height: 22px;
}
.style11
{
width: 131px;
}
.style12
{
width: 144px;
height: 22px;
}
.style13
{
width: 144px;
}
.style14
{
width: 7px;
height: 22px;
}
.style15
{
width: 7px;
}
.style16
{
width: 163px;
height: 22px;
}
.style17
{
width: 163px;
}
.style18
{
width: 173px;
height: 22px;
}
.style19
{
width: 173px;
}
.style20
{
width: 76px;
height: 22px;
}
.style21
{
width: 76px;
}
.style22
{
width: 50px;
height: 22px;
}
.style23
{
width: 50px;
}
.style24
{
width: 47px;
}
.style25
{
width: 50px;
font-weight: bold;
height: 25px;
}
.style26
{
width: 7px;
font-weight: bold;
height: 25px;
}
.style27
{
width: 32px;
font-weight: bold;
}
.style28
{
width: 100%;
font-size: 10pt;
font-family: Arial, Helvetica, sans-serif;
}
.style31
{
width: 182px;
}
.style33
{
width: 118px;
font-weight: bold;
font-size: 10pt;
font-family: Arial, Helvetica, sans-serif;
}
.style37
{
width: 118px;
font-weight: bold;
}
.style39
{
width: 118px;
height: 96px;
}
.style40
{
height: 96px;
}
.style42
{
width: 182px;
height: 96px;
}
.style47
{
width: 199px;
}
.style48
{
height: 96px;
width: 199px;
}
.style54
{
width: 117px;
height: 12px;
}
.style55
{
width: 117px;
font-weight: bold;
}
.style56
{
width: 117px;
height: 96px;
}
.style61
{
width: 77px;
}
.style62
{
width: 77px;
height: 96px;
}
.style64
{
width: 77px;
font-weight: bold;
}
.style69
{
width: 118px;
font-weight: bold;
height: 12px;
}
.style70
{
width: 199px;
height: 12px;
}
.style72
{
width: 182px;
height: 12px;
}
.style74
{
width: 77px;
height: 12px;
}
.style75
{
height: 12px;
}
.style76
{
width: 118px;
height: 22px;
}
.style77
{
width: 117px;
height: 22px;
}
.style82
{
width: 199px;
height: 22px;
}
.style84
{
width: 182px;
height: 22px;
}
.style85
{
width: 77px;
height: 22px;
}
.style86
{
height: 22px;
}
.style87
{
width: 4px;
height: 25px;
}
.style88
{
width: 32px;
font-weight: bold;
height: 25px;
}
.style89
{
width: 144px;
height: 25px;
}
.style90
{
width: 163px;
height: 25px;
}
.style91
{
width: 173px;
height: 25px;
}
.style92
{
width: 76px;
height: 25px;
}
.style93
{
width: 131px;
height: 25px;
}
.style94
{
width: 47px;
height: 25px;
}
.style95
{
width: 4px;
height: 22px;
}
.style96
{
width: 4px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<br />
<table class="style28">
<tr>
<td class="style95">
</td>
<td class="style8">
</td>
<td class="style12">
</td>
<td class="style16">
</td>
<td class="style14">
</td>
<td class="style18">
</td>
<td class="style20">
</td>
<td class="style22">
</td>
<td class="style11">
</td>
<td class="style24">
</td>
</tr>
<tr>
<td class="style96">
</td>
<td class="style3">
</td>
<td class="style13">
</td>
<td class="style17">
</td>
<td class="style15">
</td>
<td class="style19">
</td>
<td class="style21">
</td>
<td class="style23">
</td>
<td class="style11">
</td>
<td class="style24">
</td>
</tr>
<tr>
<td class="style96">
</td>
<td class="style27">
Type</td>
<td class="style13">
<asp:DropDownList ID="DropDownTYPE" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceTYPE" DataTextField="Categ"
DataValueField="Num_categ" Height="18px" Width="154px">
</asp:DropDownList>
</td>
<td class="style17">
<asp:TextBox ID="TextBoxtype" runat="server" Width="149px" Height="22px"></asp:TextBox>
</td>
<td class="style15">
<asp:Button ID="Button1" runat="server" Text="Ajouter" style="height: 26px" />
</td>
<td class="style19">
</td>
<td class="style21">
</td>
<td class="style23">
</td>
<td class="style11">
</td>
<td class="style24">
</td>
</tr>
<tr>
<td class="style96">
</td>
<td class="style3">
</td>
<td class="style13">
</td>
<td class="style17">
</td>
<td class="style15">
</td>
<td class="style19">
</td>
<td class="style21">
</td>
<td class="style23">
</td>
<td class="style11">
</td>
<td class="style24">
</td>
</tr>
<tr>
<td class="style87">
</td>
<td class="style88">
Marque</td>
<td class="style89">
<asp:DropDownList ID="DropDownMARQUE" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceMARQUE" DataTextField="marque" DataValueField="marque"
Height="17px" Width="151px">
<asp:ListItem>.Sans</asp:ListItem>
</asp:DropDownList>
</td>
<td class="style90">
</td>
<td class="style26">
Modèle</td>
<td class="style91">
<asp:DropDownList ID="DropDownMODEL" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceMODEL" DataTextField="modele" DataValueField="modele"
style="height: 18px; width: 143px">
</asp:DropDownList>
</td>
<td class="style92">
</td>
<td class="style25">
Numéro</td>
<td class="style93">
<asp:DropDownList ID="DropDownNUM" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceNUM" DataTextField="numero" DataValueField="numero"
Height="25px" Width="142px">
</asp:DropDownList>
</td>
<td class="style94">
</td>
</tr>
<tr>
<td class="style96">
</td>
<td class="style3">
</td>
<td class="style13">
<asp:TextBox ID="TextBoxmarque" runat="server" Width="150px"></asp:TextBox>
</td>
<td class="style17">
<asp:Button ID="Button5" runat="server" Height="26px" Text="Ajouter" />
</td>
<td class="style15">
</td>
<td class="style19">
<asp:TextBox ID="TextBoxmodele" runat="server" Width="143px"></asp:TextBox>
</td>
<td class="style21">
<asp:Button ID="Button2" runat="server" Text="Ajouter" />
</td>
<td class="style23">
</td>
<td class="style11">
<asp:TextBox ID="TextBoxnumero" runat="server" Width="136px"></asp:TextBox>
</td>
<td class="style24">
<asp:Button ID="Button3" runat="server" Text="Ajouter" />
</td>
</tr>
</table>
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="code_materiel" DataSourceID="SqlDataSource1" Height="133px"
RowHeaderColumn="code_materiel" Width="111px">
<Columns>
<asp:BoundField DataField="code_materiel" HeaderText="code_materiel"
InsertVisible="False" ReadOnly="True" SortExpression="code_materiel" />
</Columns>
</asp:GridView>
<br />
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:Button ID="Button7" runat="server" Text="test" Width="36px" />
<table class="style28">
<tr>
<td class="style33">
Numéro de série</td>
<td class="style47">
<asp:TextBox ID="TextBoxnumserie" runat="server" Width="150px"></asp:TextBox>
</td>
<td class="style55">
Code barre</td>
<td class="style31">
<asp:TextBox ID="TextBoxcodebarre" runat="server" Width="151px"></asp:TextBox>
</td>
<td class="style64">
Fournisseur</td>
<td>
<asp:DropDownList ID="DropDownfournisseur" runat="server" AutoPostBack="True"
DataSourceID="SqlDataSourceFOURNISSEUR" DataTextField="nom_fournisseur"
DataValueField="id_fournisseur" Height="16px" Width="164px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style76">
</td>
<td class="style82">
</td>
<td class="style77">
</td>
<td class="style84">
</td>
<td class="style85">
</td>
<td class="style86">
</td>
</tr>
<tr>
<td class="style37">
Date de réception</td>
<td class="style47">
<dxe:ASPxDateEdit ID="ASPxDateEdit1" runat="server"
CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass"
Height="24px" ImageFolder="~/App_Themes/BlackGlass/{0}/" Width="171px">
<ButtonStyle Width="11px">
</ButtonStyle>
<ValidationSettings>
<ErrorImage Height="14px" Url="~/App_Themes/BlackGlass/Editors/Error.gif"
Width="14px" />
<ErrorFrameStyle ImageSpacing="4px">
<ErrorTextPaddings PaddingLeft="4px" />
</ErrorFrameStyle>
</ValidationSettings>
<CalendarProperties>
<HeaderStyle Spacing="1px" />
<FooterStyle Spacing="4px" />
<FastNavProperties Enabled="False" />
</CalendarProperties>
</dxe:ASPxDateEdit>
</td>
<td class="style55">
Date fin garantie</td>
<td class="style31">
<dxe:ASPxDateEdit ID="ASPxDateEdit2" runat="server"
CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass"
ImageFolder="~/App_Themes/BlackGlass/{0}/" height="24px" width="171px">
<ButtonStyle Width="11px">
</ButtonStyle>
<ValidationSettings>
<ErrorImage Height="14px" Url="~/App_Themes/BlackGlass/Editors/Error.gif"
Width="14px" />
<ErrorFrameStyle ImageSpacing="4px">
<ErrorTextPaddings PaddingLeft="4px" />
</ErrorFrameStyle>
</ValidationSettings>
<CalendarProperties>
<HeaderStyle Spacing="1px" />
<FooterStyle Spacing="4px" />
</CalendarProperties>
</dxe:ASPxDateEdit>
</td>
<td class="style61">
</td>
<td>
</td>
</tr>
<tr>
<td class="style39">
</td>
<td class="style48">
</td>
<td class="style56">
</td>
<td class="style42">
</td>
<td class="style62">
</td>
<td class="style40">
</td>
</tr>
<tr>
<td class="style69">
</td>
<td class="style70">
</td>
<td class="style54">
</td>
<td class="style72">
</td>
<td class="style74">
</td>
<td class="style75">
</td>
</tr>
</table>
<br />
<asp:Button ID="Button6" runat="server" Text="Ajouter le materiel"
style="text-align: left; margin-top: 0px" Width="133px" />
<br />
<br />
<asp:SqlDataSource ID="SqlDataSourceMARQUE" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT DISTINCT [marque] FROM [materiel]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceNUM" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT DISTINCT [numero] FROM [materiel] WHERE (([Num_categ] = @Num_categ) AND ([marque] = @marque) AND ([modele] = @modele))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownTYPE" Name="Num_categ"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownMARQUE" Name="marque"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownMODEL" Name="modele"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceTYPE" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT DISTINCT [Num_categ], [Categ] FROM [type_materiel]"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceMODEL" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT DISTINCT [modele] FROM [materiel] WHERE (([Num_categ] = @Num_categ) AND ([marque] = @marque))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownTYPE" Name="Num_categ"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownMARQUE" Name="marque"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourcesave" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT * FROM [parc]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourceFOURNISSEUR" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT DISTINCT [id_fournisseur], [nom_fournisseur] FROM [fournisseur]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSourcetest" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>" SelectCommand="select right(max(id_materiel),2)+1 from parc
where left(id_materiel,3)= 109"></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT [code_materiel] FROM [materiel] WHERE (([Num_categ] = @Num_categ) AND ([marque] = @marque) AND ([modele] = @modele) AND ([numero] = @numero))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownTYPE" Name="Num_categ"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownMARQUE" Name="marque"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownMODEL" Name="modele"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownNUM" Name="numero"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:CTIPARKConnectionString1 %>"
SelectCommand="SELECT [code_materiel] FROM [materiel] WHERE (([Num_categ] = @Num_categ) AND ([marque] = @marque) AND ([modele] = @modele) AND ([numero] = @numero))">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownTYPE" Name="Num_categ"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="DropDownMARQUE" Name="marque"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownMODEL" Name="modele"
PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="DropDownNUM" Name="numero"
PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
<br />
<br />
</form>
</body>
</html>
le code vb est
Partial Class page1
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
SqlDataSourceTYPE.InsertCommand = "INSERT INTO type_materiel(categ) VALUES ('" + TextBoxtype.Text + "')"
SqlDataSourceTYPE.Insert()
TextBoxtype.Text = ""
End Sub
Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
SqlDataSourceMARQUE.InsertCommand = "INSERT INTO materiel (Num_categ, marque,modele, numero) VALUES ('" + DropDownTYPE.SelectedValue + "', '" + TextBoxmarque.Text + "', '.Sans Modele', '.Sans Numero')"
SqlDataSourceMARQUE.Insert()
TextBoxmarque.Text = ""
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
SqlDataSourceMODEL.InsertCommand = "INSERT INTO materiel (Num_categ, marque,modele,numero) VALUES ('" + DropDownTYPE.SelectedValue + "', '" + DropDownMARQUE.SelectedValue + "', '" + TextBoxmodele.Text + "','.Sans Numero')"
SqlDataSourceMODEL.Insert()
TextBoxmodele.Text = ""
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
SqlDataSourceNUM.InsertCommand = "INSERT INTO materiel (Num_categ, marque,modele,numero) VALUES ('" + DropDownTYPE.SelectedValue + "', '" + DropDownMARQUE.SelectedValue + "', '" + DropDownMODEL.SelectedValue + "', '" + TextBoxnumero.Text + "')"
SqlDataSourceNUM.Insert()
TextBoxnumero.Text = ""
End Sub
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click
SqlDataSourcesave.InsertCommand = "insert into parc (id_materiel,num_serie,code_barre,code_materiel,id_etat,date_reception,date_f_garantie) values (10933,'" + TextBoxnumserie.Text + "','" + TextBoxcodebarre.Text + "','" + GridView1.SelectedValue + "',1,'" + ASPxDateEdit1.Text + "','" + ASPxDateEdit2.Text + "') "
SqlDataSourcesave.Insert()
TextBoxcodebarre.Text = ""
TextBoxnumserie.Text = ""
ASPxDateEdit1.Text = ""
ASPxDateEdit2.Text = ""
End Sub
Protected Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text = GridView1.SelectedRow.Cells(1).Text
End Sub
End Class