Bonjour,

je voudrais récupérer des informations d'une ligne de la gridview
j'y arrive jusqu'au moment ou je passe à une autre page de la gridview...
je n'arrive plus a récupérer la datakeys de l'élément 21 en supposant que pagesize = 20

en fait, les datakeys ne stock que par bloc de "pagesize" (si pagesize est égal à 30, la collection des datakeys ne contiendra que les 30 meme si la gridview contient 100 records)



html :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 
<asp:GridView ID="gvRundown" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
                    AllowPaging="true" AllowSorting="true" PageSize="20" AutoGenerateColumns="false"
                    DataKeyNames="bit_guid, bit_flag, bit_mobile" Width="98%">
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#EFF3FB" />
                    <EditRowStyle BackColor="#2461BF" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:BoundField DataField="bit_title" HeaderText="Titre" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Left" Width="30%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_channel" HeaderText="Channel" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_broadcasting_date" HeaderText="Date" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_broadcasting_time" HeaderText="Heure" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_duration" HeaderText="Durée" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="4%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_category" HeaderText="Catégorie" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="6%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_media" HeaderText="Media" ReadOnly="true">
                            <ItemStyle HorizontalAlign="Center" Width="5%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_clip_title" HeaderText="Titre (Clip)" ReadOnly="true"
                            Visible="false">
                            <ItemStyle HorizontalAlign="Center" Width="15%" />
                        </asp:BoundField>
                        <asp:BoundField DataField="bit_clip_artist" HeaderText="Interprete (Clip)" ReadOnly="true"
                            Visible="false">
                            <ItemStyle HorizontalAlign="Center" Width="15%" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Event" ItemStyle-Width="5%">
                            <ItemTemplate>
                                <asp:ImageButton ID="flag_Event" runat="server" CommandName="FLAG" ImageUrl="~/Images/flag.gif"
                                    CommandArgument='<%# Container.DataItemIndex %>' Width="18px" Height="18px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Mobile" ItemStyle-Width="5%">
                            <ItemTemplate>
                                <asp:ImageButton ID="flag_Mobile" runat="server" CommandName="MOBILE" ImageUrl="~/Images/flag.gif"
                                    CommandArgument='<%# Container.DataItemIndex %>' Width="18px" Height="18px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
code behind :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
Dim gv As GridView = CType(sender, GridView)
 
        Select Case e.CommandName.ToUpper
            Case "FLAG"
                If gv.DataKeys(e.CommandArgument).Item("bit_flag") Then
                    Me.updateFlagEvent(gv.DataKeys(e.CommandArgument).Item("bit_guid").ToString, False)
                Else
                    Me.updateFlagEvent(gv.DataKeys(e.CommandArgument).Item("bit_guid").ToString, True)
                End If
            Case "MOBILE"
                If gv.DataKeys(e.CommandArgument).Item("bit_flag") Then
                    Me.updateFlagMobile(gv.DataKeys(e.CommandArgument).Item("bit_guid").ToString, False)
                Else
                    Me.updateFlagMobile(gv.DataKeys(e.CommandArgument).Item("bit_guid").ToString, True)
                End If
        End Select
 
        If Not Me.getRundown Then
 
        End If
merci d'avance,

bien à vous.