Bonjour,
J'ai un souci dans un userobject qui est à l'intérieur d'un panel Ajax.
Dans mon userobject il y a une gridview et un asp:ImageButton,
quand je clique sur le bouton l'evt page_load est déclenché la première fois tous seul, et la grille est réinitialisée...
ensuite je dois cliquer une seconde fois pour déclencher l'évt rattaché au bouton...

voici mon code dans le ascx.cs :
************************
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        protected void btnNew_Click1(object sender, ImageClickEventArgs e)
        {
            BSEQU_MENU_LIBELLES lSessionBSEQU_MENU_LIBELLES = new BSEQU_MENU_LIBELLES();
            lSessionBSEQU_MENU_LIBELLES = sessionBSEQU_MENU_LIBELLES;
            lSessionBSEQU_MENU_LIBELLES.InsertEQU_MENU_LIBELLES(0, 0, 0, 1, "pp");
            GridView1.DataSourceID = "";
            GridView1.DataSource = lSessionBSEQU_MENU_LIBELLES.EQU_MENU_LIBELLES;
            GridView1.DataMember = lSessionBSEQU_MENU_LIBELLES.EQU_MENU_LIBELLES.TableName;
 
            GridView1.DataBind();
        }

L' ascx :
******
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
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
90
91
92
93
94
95
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MenuDetail.ascx.cs" Inherits="Acs.SCONF.Web.Pages.Equipement.Menu.MenuDetail" %>
<%@ Register Assembly="Socle2Web" Namespace="Socle2Web" TagPrefix="cc1" %>
 
<div id="divOngletz" class="OngletsStyle">
 
 
    <table>
        <tr>
            <td> 
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                    DataKeyNames="ITEM_ID,TYPE_LIGNE,NUM_LIGNE,LANG_CODE" 
                    onrowdatabound="GridView1_RowDataBound">
                    <Columns>
                        <asp:TemplateField HeaderText="Langue">
                         <ItemTemplate> 
                            <asp:DropDownList ID="ddlLangue" runat="server" style="width:100px;">
                            </asp:DropDownList>                        
                         </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="N° Ligne">
                         <ItemTemplate>
                           <asp:TextBox MaxLength="1" runat="server" 
                               ID="txtNUM_LIGNE"  />
                         </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Libellé">
                         <ItemTemplate>
                           <asp:TextBox MaxLength="40" runat="server" 
                               ID="txtLIBELLE_LIGNE"  />
                         </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="ITEM_ID" HeaderText="ITEM_ID" ReadOnly="True" 
                            SortExpression="ITEM_ID"  itemstyle-cssclass="hiddencol" HeaderStyle-cssclass="hiddencol" /> 
                        <asp:BoundField DataField="TYPE_LIGNE" HeaderText="TYPE_LIGNE" ReadOnly="True" 
                            SortExpression="TYPE_LIGNE"  itemstyle-cssclass="hiddencol" HeaderStyle-cssclass="hiddencol" />
                        <asp:BoundField  DataField="LANG_CODE" HeaderText="LANG_CODE" 
                            SortExpression="LANG_CODE"  itemstyle-cssclass="hiddencol" HeaderStyle-cssclass="hiddencol" />
                        <asp:BoundField  DataField="NUM_LIGNE" HeaderText="NUM_LIGNE"  
                            SortExpression="NUM_LIGNE" DataFormatString="#"  itemstyle-cssclass="hiddencol" HeaderStyle-cssclass="hiddencol" />
                        <asp:BoundField  DataField="LIBELLE_LIGNE" HeaderText="LIBELLE_LIGNE" 
                            SortExpression="LIBELLE_LIGNE"  itemstyle-cssclass="hiddencol" HeaderStyle-cssclass="hiddencol" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
        <tr> <td>
<ul class="listTabBtn">
	<li>
        <asp:ImageButton ID="btnNew"  onclick="btnNew_Click1" runat="server" 
            Height="27px" Width="27px"    
            style="background-position: center center;
	        background-repeat: no-repeat;
	        height: 27px;
	        width: 27px;
	        border-width: 2px;
	        overflow: hidden;
	        hasLayout: -1;"     
       	ImageUrl="../../../../img/treeview/bt_petit_ajouter_O.png"
        onmouseover="this.src='../../../../img/treeview/bt_petit_ajouter_over_O.png'" 
        onmouseout="this.src='../../../../img/treeview/bt_petit_ajouter_O.png'" 
        CausesValidation="False" BorderStyle="Outset" />
	</li>
	<li>
        <asp:ImageButton ID="btnDelete2"  onclick="btnDelete2_Click" runat="server" 
            Height="27px" Width="27px"    
            style="background-position: center center;
	        background-repeat: no-repeat;
	        height: 27px;
	        width: 27px;
	        border-width: 2px;
	        overflow: hidden;
	        hasLayout: -1;"     
       	ImageUrl="../../../../img/treeview/bt_petit_supprimer_O.png"
        onmouseover="this.src='../../../../img/treeview/bt_petit_supprimer_over_O.png'" 
        onmouseout="this.src='../../../../img/treeview/bt_petit_supprimer_O.png'" 
        CausesValidation="False" BorderStyle="Outset" />
	</li>
</ul>
</td>
</tr> 
    </table>
 
</div>
 
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="FillLikeDS" 
    TypeName="Acs.BS.BSEQU_MENU_LIBELLES">
    <SelectParameters>
        <asp:Parameter Name="p_ITEM_ID" Type="Object" />
        <asp:Parameter Name="p_TYPE_LIGNE" Type="Object" />
        <asp:Parameter Name="p_NUM_LIGNE" Type="Object" />
        <asp:Parameter Name="p_LANG_CODE" Type="Object" />
        <asp:Parameter Name="p_LIBELLE_LIGNE" Type="Object" />
        <asp:Parameter Name="pAll" Type="Boolean" />
    </SelectParameters>
</asp:ObjectDataSource>