VB Form Equivalent to Asp.net Nested Repeaters

curlydog

Well-known member
Joined
Jul 5, 2010
Messages
50
Programming Experience
Beginner
Hi All,
this is my first post so please go easy on me!

I'm trying to convert an asp.net website to a vb.net application. It's my first go with vb.net so please try and make any responses as simple as possible.

On my website I have a page that uses nested repeaters. The data source is a dataset with relations.

Im trying to replicate this in a form. I've created my dataset and relations, but I'm struggling to find the best way to display my data within the form. For each parent row there can be a varying amount of child rows.

The parent row simply shows an index number via label. The child rows contain text that can vary from a single character to 1000 characters.

I have tried to use a dataRepeater as the parent control and a datagridview as the child control.

I'm struggling to find out how, and at what point, to bind the data to the datagridview.

I'd be very grateful for any suggestions as to how to solve my problem and for any example code.

Many thanks
Jason
 
Last edited:
Do you really want to display all the data at the same time? Would it maybe make more sense in a WinForms app to show all the parent data, maybe in a ComboBox or DataGridView, and then show the child data only for the currently selected parent record?
 
It's a little more complicated than that.
The original data was read from a spreadsheet into a sql server database. In the original spreadsheets different rows have values in varying columns, in that in one row a particular column may have a value, but on another row that column may be empty. Also one row may have two columns with values, whilst another row may have eight columns with values.

In order to cater for this variance in the original data, it is stored in the database in the following manner.
RowNumber, ColumnNumber, Column Heading, StoredData

Therefore, in order to present related data to the user as a single record, I need to group them together based on the RowNumber. As the number of columns related to each record can vary I can't simply design a form to show the data. This wouldn't cater for circumstances where one record has three columns to display and the next has five.

In my web page the rowNumber formed the parent repeater, whilst the columns associated to it formed the nested repeater. This is what I'm trying to replicate.

Based on your suggestion I'm, trying to think of other ways of doing this. It may be possible to have something like a datagridview which displays the columns associated with a particular row. The user could then click a "Next" button to fill the datagridview with the columns associated with the next row.

As I mentioned previously, this is my first attempt at a Winforms application, so really I'm looking for suggestions at the best way of displaying varying amounts of data within the same control.

Thanks
Jason
 
Maybe it's not what you want but I would think that you could just create a single table holding all the data. Not necessarily in the database but in your app you could. Retrieve all the data, ordered by row number and column number, and then get the largest column number and create a DataTable with that many columns. You can then loop through the original data and copy the field values across to the new table in the appropriate columns, then bind the new table to a single grid.
 
Back
Top