ListView activate Add/Edit/delete/ buttons when select an item of the list


ListView activate Add/Edit/delete/ buttons when select an item of the...
Author
Message
Juan Carlos Pazos
Juan Carlos Pazos
StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)StrataFrame User (228 reputation)
Group: Forum Members
Posts: 144, Visits: 227
Hi

I'm having a problem similar to one reported before by Edhy:

Hi Trent,

Following my working with the ListView, I noticed that when using the ListView in a One2Many form and there is not record in the parent BO the Add button of the the ListView is still Enabled which will caused an error when clicking this button and the ChildForm will try to update the FK key with no valid record in the parent.

I have been looking at the source and the list events to see where I could put code to disable the cmdAdd button in the list if there is no parent record.  Can you please give me hand here?

I read all the answers and found the solution for the Add button to remain disabled, but I found a new problem; if I have some elements on the list and clic on one of them, the Add/Edit/Delete buttons get active, the code for handle the buttons state is the same so these buttons should not be enabled if the EditState of the form is not enabled.

Private Sub SetPreciosProveedorButtonState()

' Sets the enabled state of the buttons

'-- Establish Locals

Dim llSelected As Boolean = Me.lvProveedores.SelectedItems.Count > 0

'-- See if the buttons can be enabled

Me.tsBtnNuevoPrecioProveedor.Enabled = Me.ProductosBO1.EditingState <> BusinessEditingState.Idle

Me.tsBtnEditarPrecioProveedor.Enabled = llSelected AndAlso (Me.ProductosBO1.EditingState <> BusinessEditingState.Idle)

Me.tsBtnBorrarPrecioProveedor.Enabled = llSelected AndAlso (Me.ProductosBO1.EditingState <> BusinessEditingState.Idle)

End Sub

Looking a solution I make the same approach of the old CRM Sample Application, in the Customers form, you handle the buttons by code and not by the properties of the ListView, using this the buttons remain disabled until the form editing state is enabled. I know these sample was made before the Listview has the properties for handle directly the Add/Edit/Delete buttons.

I believe can be a small bug in the ListView, but of course can be an error in my form.

Do you have any ideas?

Regards



Smile Everything is possible, just keep trying...
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search