Recently, I needed to create a list of items that were to be manually sorted by the user. I decided to use the sorting mechanism that Netflix uses in its queue. The items are listed 1 to n on the page with the sequence number in a text box. If the user wishes to re-sequence an item all they need to do is change the number in the text box to the desired sequence number. After I created the sorting algorithm in the business collection object I started out to write the UI. I first started out using Infragisics WebGrid. It worked fine but it was dog slow and it wasn’t the look that I wanted. I then moved to the ASP:Table control and was quickly reminded that it doesn’t use viewstate. The DataGrid seemed like my next best hope although I’m not a big fan of the control. I added bound columns for the static data and a template column with a textbox in it for the sequence number. While coding the save function I needed to use the FindControl to access the data in the textbox. That’s when I came across this excellent article at OdeToCode.com titled In Search of ASP.Net Controls. To find the proper textbox I needed to access the FindControl function in specific row of the grid. For Example:
Dim SeqText As TextBox = DirectCast(SeqDataGrid.Items(i).FindControl(“SeqText”), TextBox)
With this I could iterate through the grid, grab all of the new sequence numbers, plug them into the business objects then call the sorting routine.
I also found this article on the CSS Box Model very helpful (even though it was a refresher).
Now Playing: John Coltrane – Chasin’ the Trane