Conditionally add checkbox to a row in a listview


Author
Message
Charles R Hankey
Charles R Hankey
StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)StrataFrame VIP (1.3K reputation)
Group: Forum Members
Posts: 524, Visits: 30K
Need some help clarifying my thinking. i am presenting the user with a listview of PDFForms. They are loaded from a BO. Bo.PDFstatus determines if this PDF is optional - i.e. user can select it - while all others are included by default and cannot be unincluded.



I have a PDFSelected boolean (bit) field in the PDFbo. When the user gets done with the list I want to process all the PDFs from this BO, including any that are selected in the list and all those that are required.



If I want to handle this in one listview, can I conditionally have a checkbox only on the optional rows?? Should that be added somehow in rowpopulating and should they be attached to the PDFSelected or to the PDFName - first column of list. ?



In order to do this, do I need to populated the listview manually or can I still do a copydatafrom ?



I know how to updatae PDFBO from the listview selection once choices are made (that's why I'm not using new Stratalistview as there doesn't seem to be SelectedIndex expose )



Any thoughts appreciated, very much under the gun on this w00t

Reply
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Charles,



If you are using the current Listview, you could also handle the ItemChecked event and validate it so if the user uncheck a required item, you simply check it again, here is a sample:



Private Sub lstPayments_ItemChecked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemCheckedEventArgs) Handles lstPayments.ItemChecked

If Me.bizPayments_Daily.PaymentStatus = Enumerations.PaymentStatus.Paid Then

If e.Item.Checked = False Then

e.Item.Checked = True

End If

End If

End Sub





Of course you can do it in a single line like e.Item.Checked = MyBO.RequiredConditionField = True




Edhy Rijo

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