DataGrid PushButton

ValentinBadea

Newcomer
Joined
Mar 2, 2004
Messages
4
Location
Romania
Hello !

2 questions:

1) I have a datagrid with a button column and this code for getting info from a row

Code:
Private Sub MyDataGrid_ItemCommand(ByVal source As Object, _
                                   ByVal e As  System.Web.UI.WebControls.DataGridCommandEventArgs) _
                                   Handles MyDataGrid.ItemCommand

        Label1.Text = e.Item.Cells(2).Text()
End Sub
If Button Column is a LinkButton - > OK
If Button Column is a PushButton - > this sub is not accessed (debug stop not stopped). What is wrong ?

2) How can be implemented a column in a datagrid with PushButtons on it and different captions for this buttons (for each row another caption on his button) ?
 
Resolved !

I missed to add this on Page_Load

Code:
[B]If Not Page.IsPostBack Then[/B]
  MyDataGrid.Databind()
[B]end if[/B]

so button click event don't fired becouse
rebinding of the DataGrid flushes out the ItemCommand event
 
Back
Top