Masquer certaines lignes d'un datagrid
Bonjour,
je souhaiterais masquer certaines lignes au load de mon datagrid en appelant une fonction qui "filtre" les données d'après certains critères.
Voici ma fonction :
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
| Public Sub CacheLigne(ByVal monobject As System.Object, _
ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs)
Dim SQLRow As DataRow
Dim Index As Integer = 0
Dim ServDemandeur As String
For Each SQLRow In monobject.Rows
If ExceptionVrai = True Then
ServDemandeur = CType(monobject.FindControl("Service_1"), Label).Text
ElseIf ExceptionVrai = False Then
ServDemandeur = CType(monobject.FindControl("Service_2"), Label).Text
End If
If Direction = "A" Or Direction = "CG" _
Or Direction2 = ServDemandeur Then
monobject.Rows(Index).Visible = True
Else
monobject.Rows(Index).Visible = False
End If
Index += 1
Next
End Sub |
J'aimerais savoir comment l'appeler dans le datagrid lui-même, au même titre qu'une fonction qu'on appelle dans un ImageButton (onCommand) de mon datagrid, à savoir:
Code:
1 2 3 4 5 6 7 8
| <ASP:TEMPLATECOLUMN>
<ITEMTEMPLATE>
<ASP:IMAGEBUTTON id="IMGvoir" Runat="server" AlternateText="Voir la D.A" ImageUrl="img/voir.gif"
CommandArgument='<%# DataBinder.Eval(Container,"DataItem.Numero_DA")%>'
OnCommand="VoirDA" CommandName=Voir">
</ASP:IMAGEBUTTON>
</ITEMTEMPLATE>
</ASP:TEMPLATECOLUMN> |
Est-ce possible?
Par avance, merci pour votre aide.