Sorry. This is my code :
In my aspx file, I have a datagrid with the "OnItemCreated" parameter.
In my code behind (VB file), I have built all the buttons by code
(ImageButton).
The Handler on the differents ImageButtons seems not be fire under .net
2.0
It is ok under 1.1
In my datagrid The parameter OnItemCreated is
OnItemCreated="my009DataGrid_ItemCreated"
(see part 2)
part 1/ My code file in my .vb file
------------------------------------
Sub my009DataGrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Header Then
'ImageButton Header column : e.Item.Cells(0)
Dim myLibEve As New Label
With myLibEve
.Id="myLibEve"
.Text=myLocalization.EasyResourceManager.myGetString("myLibEve","patent.aspx")
.EnableViewState = ctype("False",Boolean)
.CssClass="txtOres2"
.Attributes.Add("runat", "server")
End With
'ADD Control ImageButton UP LIBEVE.
Dim myBtnLibEveUp As New ImageButton
With myBtnLibEveUp
.ImageUrl="/img/gen/up.gif"
.EnableViewState = ctype("False",Boolean)
.CausesValidation=ctype("False",Boolean)
.Attributes.Add("runat", "server")
.Attributes.Add("onMouseOver", "window.status=' '; return true;")
.AlternateText=myLocalization.EasyResourceManager.myGetString("BtnLibEveUp","patent.aspx")
.Id="myBtnLibEveUp"
.CommandArgument="LIBEVE ASC"
AddHandler myBtnLibEveUp.Command, New CommandEventHandler(AddressOf
myImgButtonSorting)
End With
'ADD Control ImageButton DOWN LIBEVE.
Dim myBtnLibEveDown As New ImageButton
With myBtnLibEveDown
.ImageUrl="/img/gen/down.gif"
.EnableViewState = ctype("False",Boolean)
.CausesValidation=ctype("False",Boolean)
.Attributes.Add("runat", "server")
.Attributes.Add("onMouseOver", "window.status=' '; return true;")
.AlternateText=myLocalization.EasyResourceManager.myGetString("BtnLibEveDown","patent.aspx")
.Id="myBtnLibEveDown"
.CommandArgument="LIBEVE DESC"
AddHandler myBtnLibEveDown.Command, New CommandEventHandler(AddressOf
myImgButtonSorting)
End With
'Add controls in e.Item.Cells(0)
e.Item.Cells(0).Controls.Add(myLibEve)
e.Item.Cells(0).Controls.Add(myBtnLibEveUp)
e.Item.Cells(0).Controls.Add(myBtnLibEveDown)
myLibEve.Dispose()
myLibEve=Nothing
myBtnLibEveUp.Dispose()
myBtnLibEveUp=Nothing
myBtnLibEveDown.Dispose()
myBtnLibEveDown=Nothing
'Texte de la Colonne Header : e.Item.Cells(1)
'Label Colonne DATECH.
Dim myDatEch As New Label
With myDatEch
.Id="myDatEch"
.Text=myLocalization.EasyResourceManager.myGetString("myDatEch","patent.aspx")
.EnableViewState = ctype("False",Boolean)
.CssClass="txtOres2"
.Attributes.Add("runat", "server")
End With
'Ajout Control ImageButton UP DATECH.
Dim myBtnDatEchUp As New ImageButton
With myBtnDatEchUp
.ImageUrl="/img/gen/up.gif"
.EnableViewState = ctype("False",Boolean)
.CausesValidation=ctype("False",Boolean)
.Attributes.Add("runat", "server")
.Attributes.Add("onMouseOver", "window.status=' '; return
true;")
.AlternateText=myLocalization.EasyResourceManager.myGetString("BtnLibEveUp","patent.aspx")
.Id="myBtnDatEchUp"
.CommandArgument="DATECH ASC"
AddHandler myBtnDatEchUp.Command, New
CommandEventHandler(AddressOf
myImgButtonSorting)
End With
'Ajout Control ImageButton DOWN DATECH.
Dim myBtnDatEchDown As New ImageButton
With myBtnDatEchDown
.ImageUrl="/img/gen/down.gif"
.EnableViewState = ctype("False",Boolean)
.CausesValidation=ctype("False",Boolean)
.Attributes.Add("runat", "server")
.Attributes.Add("onMouseOver", "window.status=' '; return
true;")
.AlternateText=myLocalization.EasyResourceManager.myGetString("BtnLibEveDown","patent.aspx")
.Id="myBtnDatEchDown"
.CommandArgument="DATECH DESC"
AddHandler myBtnDatEchDown.Command, New
CommandEventHandler(AddressOf
myImgButtonSorting)
End With
'Ajout Effectif dans e.Item.Cells(0)
e.Item.Cells(1).Controls.Add(myDatEch)
e.Item.Cells(1).Controls.Add(myBtnDatEchUp)
e.Item.Cells(1).Controls.Add(myBtnDatEchDown)
'Libération Mémoire des trois Controls
myDatEch.Dispose()
myDatEch=Nothing
myBtnDatEchUp.Dispose()
myBtnDatEchUp=Nothing
myBtnDatEchDown.Dispose()
myBtnDatEchDown=Nothing
'Texte de la Colonne Header : e.Item.Cells(2)
'Label Colonne NATURE.
Dim myNature As New Label
With myNature
.Id="myNature"
.Text=myLocalization.EasyResourceManager.myGetString("myNature","patent.aspx")
.EnableViewState = ctype("False",Boolean)
.CssClass="txtOres2"
.Attributes.Add("runat", "server")
End With
'Ajout Effectif dans e.Item.Cells(0)
e.Item.Cells(2).Controls.Add(myNature)
'Libération Mémoire des trois Controls
myNature.Dispose()
myNature=Nothing
End If '.Item.ItemType = ListItemType.Header
End Sub 'my009DataGrid_ItemCreated
part 2/ In .aspx file : My datagrid with OnItemCreated parameter
<asp
ataGrid id="my009DataGrid"
runat="server"
FooterStyle-BorderWidth="0"
ShowFooter="False"
FooterStyle-BackColor="#F29168"
FooterStyle-ForeColor="#FFFFFF"
FooterStyle-BorderStyle= "None"
PagerStyle-Mode="NumericPages"
PageCount="1"
AutoGenerateColumns="False"
borderwidth="1"
bordercolor="black"
BorderStyle="Solid"
PagerStyle-VerticalAlign="top"
Cellpadding="1"
Cellspacing="0"
ShowHeader="True"
HeaderStyle-ForeColor="White"
HeaderStyle-Font-Bold="False"
HeaderStyle-HorizontalAlign="Center"
HeaderStyle-VerticalAlign="Middle"
AllowSorting="False"
AllowPaging="True"
OnPageIndexChanged="PageIndexChanged_OnClick"
OnItemCreated="my009DataGrid_ItemCreated"
PageSize="5"
width="100%"
HeaderStyle-BackColor="#93b0cc"
BackColor="#e5ecf2"
AlternatingItemStyle-BackColor="#e5ecf2"
PagerStyle-Backcolor="#93b0cc"
PagerStyle-Forecolor="Black"
PagerStyle-HorizontalAlign="Right"
PagerStyle-BorderStyle="Inset">
<Columns>
<asp:BoundColumn DataField="libeve" ReadOnly="true">
<ItemStyle Font-Names="Times New Roman, Times, serif" ForeColor="#003B6F"
Font-Size="10" horizontalalign="Left" VerticalAlign="Middle" width="40%">
</ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="datech" DataFormatString="{0:d}"
ReadOnly="true">
<ItemStyle Font-Names="Times New Roman, Times, serif" ForeColor="#003B6F"
Font-Size="10" horizontalalign="Center" VerticalAlign="Middle"
width="30%">
</ItemStyle>
</asp:BoundColumn>
<asp:BoundColumn DataField="nature" ReadOnly="true" HeaderText="Nature">
<ItemStyle Font-Names="Times New Roman, Times, serif" ForeColor="#003B6F"
Font-Size="10" horizontalalign="Center" VerticalAlign="Middle"
width="30%">
</ItemStyle>
</asp:BoundColumn>
</Columns>
</asp
ataGrid>
thanks for your help