Look my problem :
PAGE ASPX :
#Region " - Page_Load - "
Public Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not Page.IsPostBack Then
monStyle.Text = Session("style" )
bindData()
Session("select ionligne") = -1
End If
End Sub
#End Region
#Region " - bindData - "
Public Sub bindData()
daAdminProspect s.Fill(Bts1)
dgAdminProspect s.DataSource = myDataview
dgAdminProspect s.DataBind()
End Sub
#End Region
#Region " - ItemDataBound - "
Private Sub dgClient_ItemDa taBound(ByVal sender As Object, ByVal e
As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
dgAdminProspect s.ItemDataBound
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then
Dim imgDelete As ImageButton =
CType(e.Item.Fi ndControl("imgD elete"), ImageButton)
CreateConfirmBo x(imgDelete, "Attention, merci de confirmer
la suppression.")
End If
End Sub
#End Region
#Region " - ItemCommand - "
Private Sub dgAdminProspect s_ItemCommand(B yVal source As Object,
ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
dgAdminProspect s.ItemCommand
If e.Item.ItemType = ListItemType.It em Or e.Item.ItemType =
ListItemType.Al ternatingItem Then
If e.CommandName = "Select" Then
dgAdminProspect s.EditItemIndex = -1
bindData()
End If
End If
End Sub
#End Region
#Region " - SelectedIndexCh anged - "
Private Sub dgAdminProspect s_SelectedIndex Changed(ByVal sender As
Object, ByVal e As System.EventArg s) Handles
dgAdminProspect s.SelectedIndex Changed
If dgAdminProspect s.SelectedIndex = Session("select ionLigne")
Then
dgAdminProspect s.SelectedIndex = -1
Session("select ionLigne") = -1
bindData()
Else
'Pas le meme => initialise la session("select ionLigne")
Session("select ionLigne") = dgAdminProspect s.SelectedIndex
End If
End Sub
#End Region
#Region " - PreRender - "
Private Sub dgAdminProspect s_PreRender(ByV al sender As Object, ByVal
e As System.EventArg s) Handles dgAdminProspect s.PreRender
If dgAdminProspect s.SelectedIndex > -1 Then
Dim oDGItem As New DataGridItem(0, 0, ListItemType.It em)
Dim oCell As New TableCell
oCell.Horizonta lAlign = HorizontalAlign .Left
oCell.ColumnSpa n = dgAdminProspect s.Columns.Count
oDGItem.Cells.A dd(oCell)
Dim myUC As ficheProspects =
CType(Page.Load Control("ficheP rospects.ascx") , ficheProspects)
myUC.monId =
CType(dgAdminPr ospects.DataKey s(dgAdminProspe cts.SelectedInd ex),
Integer)
'Vérifie si la couleur est alternative
If dgAdminProspect s.SelectedIndex Mod 2 <> 0 Then
myUC.backcouleu r =
CType(dgAdminPr ospects.Alterna tingItemStyle.B ackColor,
System.Drawing. Color)
oCell.BackColor =
dgAdminProspect s.AlternatingIt emStyle.BackCol or
End If
oCell.Controls. Add(myUC)
dgAdminProspect s.Controls(0).C ontrols.AddAt(d gAdminProspects .SelectedInd
ex + 3, oDGItem)
End If
End Sub
#End Region
---------------------------------------------
USERCONTROL : i have a panel, a table, and a button
'Variable public pour communiquer avec la page .aspx
Private _backcouleur As System.Drawing. Color
Public Property backcouleur() As System.Drawing. Color
Get
Return _backcouleur
End Get
Set(ByVal Value As System.Drawing. Color)
_backcouleur = Value
End Set
End Property
Private _monId As Integer
Public Property monId() As Integer
Get
Return _monId
End Get
Set(ByVal Value As Integer)
_monId = Value
End Set
End Property
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
' Changer le background des panel
panelProspects. BackColor = backcouleur
panelProspectsU pdate.BackColor = backcouleur
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Response.Write( "TEST")
End Sub
-----------------------------------------------
If i click the button in the userControl... it break my aspx datagrid
and it doesn't access to Private Sub Button1_Click
What is the solution to click use the button is the userControl ?
*** Sent via Developersdex
http://www.developersdex.com ***