Erreur récupération de données dans répéteur
Bonjour,
J'ai un petit répéteur :
Code:
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
<asp:Repeater ID="rptCompteur" runat="server" EnableViewState="true">
<ItemTemplate>
<br />
<div id="divMat" runat="server" style="position: relative;">
<div id="divHr" runat="server">
<hr style="height: 5px; background-color: #000000; border: none;" />
</div>
<div style="width: 300px; float: left;">
<asp:Label ID="locLibCopieur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LibMateriel")%> '
CssClass="lblRefMat" ToolTip='<%# DataBinder.Eval(Container.DataItem, "Aide")%>'></asp:Label>
</div>
<div style="width: 150px; float: left;">
(Modèle :
<asp:Localize ID="locRefCopieur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "RefMateriel")%>'></asp:Localize>
</div>
<div style="width: 200px; float: left;">
- Numéro de série :
<asp:Localize ID="locNumSer" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "NumSerie")%>'></asp:Localize>)
</div>
<br />
<hr style="height: 2px; background-color: #DDDDDD; border: none; left: 300px; position: absolute;
right: 50px;" />
<br />
</div>
<div style="left: 350px; position: absolute;">
<div style="width: 150px; float: left;">
<asp:Localize ID="locLibCompteur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LibCompteur")%>'></asp:Localize>
</div>
<div style="width: 150px; float: left;">
ancienne valeur :
<asp:Localize ID="locoldValue" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OldValue")%>'></asp:Localize>
</div>
<div style="float: left;">
Nouvelle valeur :
<asp:TextBox ID="txtNewCompteur" runat="server" MaxLength="10" Columns="10"></asp:TextBox>
<cc2:FilteredTextBoxExtender ID="FiltreNewCompteur" runat="server" TargetControlID="txtNewCompteur"
FilterType="Numbers">
</cc2:FilteredTextBoxExtender>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtNewCompteur"
Type="Integer"></asp:RangeValidator>
</div>
</div>
<br />
</ItemTemplate>
<AlternatingItemTemplate>
<div id="divMat" runat="server" style="position: relative;">
<br />
<div id="divHr" runat="server">
<hr style="height: 5px; background-color: #000000; border: none;" />
</div>
<div style="width: 300px; float: left;">
<asp:Label ID="locLibCopieur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LibMateriel")%> '
CssClass="lblRefMat" ToolTip='<%# DataBinder.Eval(Container.DataItem, "Aide")%>'></asp:Label>
</div>
<div style="width: 150px; float: left;">
(Modèle :
<asp:Localize ID="locRefCopieur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "RefMateriel")%>'></asp:Localize>
</div>
<div style="width: 200px; float: left;">
- Numéro de série :
<asp:Localize ID="locNumSer" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "NumSerie")%>'></asp:Localize>)
</div>
<br />
<hr style="height: 2px; background-color: #DDDDDD; border: none; left: 300px; position: absolute;
right: 50px;" />
<br />
</div>
<div style="left: 350px; position: absolute; vertical-align: bottom;">
<div style="width: 150px; float: left;">
<asp:Localize ID="locLibCompteur" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "LibCompteur")%>'></asp:Localize>
</div>
<div style="width: 150px; float: left;">
ancienne valeur :
<asp:Localize ID="locoldValue" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "OldValue")%>'></asp:Localize>
</div>
<div style="float: left; height: 20px;">
Nouvelle valeur :
<asp:TextBox ID="txtNewCompteur" runat="server" MaxLength="10" Columns="10"></asp:TextBox>
<cc2:FilteredTextBoxExtender ID="FiltreNewCompteur" runat="server" TargetControlID="txtNewCompteur"
FilterType="Numbers">
</cc2:FilteredTextBoxExtender>
<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtNewCompteur"
Type="Integer"></asp:RangeValidator>
</div>
</div>
<br />
</AlternatingItemTemplate>
</asp:Repeater> |
Et un bouton valider juste après
Code:
1 2
|
<asp:Button ID="btnValider" runat="server" Text="Valider" /> |
Très classic jusque là.
Quand je clique sur Valider, je ne récupère pas mes données de mon répéteur, quelqu'un sait pourquoi?
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
Protected Sub btnValider_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnValider.Click
Dim TxtErreur As New Text.StringBuilder
For Each it As RepeaterItem In rptCompteur.Items
Dim drv As DataRowView = CType(it.DataItem, DataRowView)
Dim txtQte As TextBox = CType(it.FindControl("txtNewCompteur"), TextBox)
If txtQte.Text.Trim.Length > 0 Then
Dim moninter As String = drv("Intervention").ToString
Dim inter As Intervention = Intervention.GetInter(moninter)
Dim li As Intervention.ligne_Operations = inter.Operations(CInt(drv("NumIntervention")))
li.Quantite = CInt(txtQte.Text.Trim)
Dim result As Boolean = inter.Modify(mess)
...
End If
Next
End Sub |
L'affichage de mes données : aucun problème par contre sur le clique de validation it.dataitem est à nothing et ma textebox est vide, alors que j'ai mis des valeurs :cry: