cancel
Showing results for 
Search instead for 
Did you mean: 

Selected rows in a table

Former Member
0 Kudos

Hi

I'm developing some screens to display data from a SQL Server database with the .Net PDK 2.0 and Visual Studio .Net 2003, I have a table and this have enabled the SelectionMode property set to Multi, so when the screen fills the table the user can select some rows, also I have configured three columns to sort the table and I have configured an ID field as the table key, well, the row selection works fine, also the sorting, but when I sort first the table by some other column than the original and try to select some row then the row selected is not the one that I select either is the one that was in the position selected originally.

Somebody know why this is happening? or most important, what can I do to solve this issue? the Developer's guide and some other documentation didn't helps to much.

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jorge,

how are you doing ?

the sorting function is as per the original key, so a simple way is to reassign the key in the sort function server side event

what you could try is keep the data table object in memory / in a hidden field on the page, and upon sort event fire, change the key of the table and then rebind the table view, and save the table locally again

with respect,

amit

Former Member
0 Kudos

Hi

Thanks for your answer, it was solved, actually it was a problem with the programming logic because I was iterating over the DataTable validating a field that indicates if the row was selected (to preserve state in database for future references), but I was executing this routine in the Page_load, so in every post back the routine validates the field and selects the rows corresponding to the DataTable position, what I do was extract this routine from the PageLoad and call it from the Search Button Event Handler.

10 points for your help

Former Member
0 Kudos

Hey Jorge,

glad to help out in any way i can )

your 10 points put me past 256 forum points, so will recieve the SDN t-shirt in time.

so thanks again to all the people with problems that i could help to solve, you have all contributed towards clothing me )

with respect,

amit

Answers (2)

Answers (2)

Former Member
0 Kudos

Jorge - would you be willing to post your code for this table example. It seems that you have done all the things that users are looking for in one table (sorting, selecting), etc...?

Former Member
0 Kudos

I will do something much better, give me your e-mail address and I will send it to you in a .zip file, because isn't only vb code, also you must configure the table columns and set some properties like Sort State, etc.

Regards

Former Member
0 Kudos

Jorge - I just noticed that you were willing to share the code. I prefer not to post my work address but here is an email address that I use for internet posting. Can you send it there. Thanks again for the help!!! inetreg@charter.net

Former Member
0 Kudos

Hi Jorge,

how are you doing ?

thank you for the 'solved problem' solution points

with respect,

amit