StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
»
Conditionally add checkbox to a row in a listview
Conditionally add checkbox to a row in a listview
Post Reply
Like
0
Conditionally add checkbox to a row in a listview
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Charles R Hankey
Charles R Hankey
posted 15 Years Ago
ANSWER
Topic Details
Share Topic
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
Reply
Like
0
Trent Taylor
Trent Taylor
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 6.9K
want to handle this in one listview, can I conditionally have a checkbox only on the optional rows??
On the new StrataListView, yes. Inherited and enhance list SF ListView, no.
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 )
Sure there is. I had a conversation with Greg through PM the other day and he was really wanting a SelectedIndices collection to be exposed. And though I will add this so people can retro fit code more easily, you don't need it. In the case of a checked list item on the new StrataListView, just call the GetCheckedItems() method and supply the column from which you are trying to get the checked items. It will return a collection of all of the items checked within that column without the need to deal with any index positioning or manualy enoerating the list.
foreach(StrataListViewItem i in sfListView.GetCheckedItems(1))
{
//-- It will return the full row, not just the sub-item. But only items with the checked box selected in the 2nd column in this example, will be returned
}
Reply
Like
0
Edhy Rijo
E
Edhy Rijo
posted 15 Years Ago
ANSWER
Post Details
Share Post
E
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
Reply
Like
0
Charles R Hankey
Charles R Hankey
posted 15 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 524,
Visits: 30K
Thanks guys. I think today I will use Edhy's approach, just because the list is already a standard list view and I can give everyone a checkbox and then kill the click for those that are required and checked by default.
But next week I'll retrofit this with a Stratalistview.
Trent, I think Greg's issue was using the code you gave me for moving rows, which works quite well with listview but chokes in Stratalistview singe SelectedIndex(0) doesn't seem to be a meaningful concept. could you give an example of doing that row moving thing with Stratalistview ( which, once again, is VERY COOL!
)
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search