Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello !

 

2 questions:

 

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

 

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) ?

Posted

Resolved !

 

I missed to add this on Page_Load

 

[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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...