vb.net - Button click on RepositoryItemButtonEdit in gridview doesn't trigger any events in DevExpress -
i have gridview 3 columns multiple rows. first 2 columns consists of client's id number , client's name. third column repositoryitembuttonedit button that, when clicked, delete client row.
i've declared repositoryitembuttonedit
following way.
dim withevents buttondelete repositoryitembuttonedit buttondelete = new repositoryitembuttonedit buttondelete.texteditstyle = texteditstyles.hidetexteditor buttondelete.buttons(0).kind = buttonpredefines.glyph buttondelete.buttons(0).caption = "supprimer" addhandler buttondelete.click, addressof me.button_click
i've added third column following way.
dim unbcolumn gridcolumn = gvexception.columns.addfield("delete") unbcolumn.visibleindex = gvexception.columns.count unbcolumn.columnedit = buttondelete gvexception.optionsview.showbuttonmode = devexpress.xtragrid.views.base.showbuttonmodeenum.showalways
the 'button click' event captured following way:
private sub button_click(byval sender system.object, byval e eventargs) handles buttondelete.click messagebox.show("hello world") end sub
when launch application, see 'delete' button each row.
problem: however, 'hello world' messagebox when click on 'delete' button first row, not when click on 'delete' button other rows.
add buttondelete.buttonpressed event instead of buttondelete.click event.
what have tried below , working fine:
dim buttondelete new repositoryitembuttonedit buttondelete.buttons.clear() buttondelete.buttonsstyle = borderstyles.ultraflat buttondelete.texteditstyle = texteditstyles.hidetexteditor dim edtrbtn editorbutton = new editorbutton() edtrbtn.kind = buttonpredefines.glyph edtrbtn.caption = "supprimer" addhandler buttondelete.buttonpressed, addressof repositoryitembuttonedit_pressed buttondelete.buttons.add(edtrbtn)
pressed event:
private sub repositoryitembuttonedit_pressed(sender object, e buttonpressedeventargs) ''' logic here end sub
it should work. rest goes ok.
Comments
Post a Comment