GridViews, DataLists, Repeaters

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
9/23/2007 12:07:44 PM
Gravatar
Total Posts 46

GridViews, DataLists, Repeaters

Hi Joe,

I'm looking through the project trying to get a feel for in what situations you're using the above controls. I know people have many different views on this so I just wanted to keep inline with what's already been done. Do you have a simple set of rules to decide when to use the following controls in the project?

Cheers

Rob

9/23/2007 5:28:47 PM
Gravatar
Total Posts 18439

Re: GridViews, DataLists, Repeaters

Hi Rob,

The Repeater is the most lightweight of them and gives the most direct control of the markup that is rendered whereas most of the other list controls render as tables. Nothing wrong with rendering tabular data as html tables so thats ok most of the time, but in any case where I don't want tables or any case where I want complete control of output I use Repeater. In some cases if its not really tabular data then its more semantic to use ul and li elements in which case I would use a Repeater for sure (ie the Links module).

If it seems semantically correct to use html tables then I use one of the other list controls, often GridView. Especially if I plan to do in place edits (where you edit directly in the grid row) I typically use GridView as Repeater doesn't have the elaborate events that come with GridView. I'm not a huge fan of the in place edit thing. I only use it for quick and dirty editing implementation for tables that don't have a lot of columns. For more interesting features I prefer the list to just link to a dedicated Edit page. I rarely use the in place edit approach inside a module control because I generally try to avoid postback inside a module control as it can have unexpected results in other modules that may be on the same page. In that situation I always link to an edit page and then link back to the page containing the module so the postback can happen on a page thats only purpose is the editing. Of course postback can be less of an issue now with ajax things like update panel but updatepanel isn't the most scalable thing so I use it judiciously.

These are just guidelines, whatever works is ok with me, each situation should be decided based on the needs, but these are some of the things I consider.

Cheers,

Joe

9/24/2007 2:53:54 AM
Gravatar
Total Posts 46

Re: GridViews, DataLists, Repeaters

Thanks for the info Joe, it's good to know your thoughts on this. One thing that still confuses me slightly is the ForumView.aspx page is rendered using a repeater but as a table? Is this because it was done pre .net 2.0 when the table rendered by DataGrid was missing <th>s or is it done for another reason?

Cheers

Rob

9/24/2007 6:31:46 AM
Gravatar
Total Posts 18439

Re: GridViews, DataLists, Repeaters

Hi Rob,

In the Forum module and in the ForumView.aspx page tables seemed appropriate but I wanted complete control of the markup because I wanted to use some of the accessibility features of table like headers attribute on td elements which will refer to the column headers (ids on th) and be read aloud by screen readers while reading each row. So in other words as a screen reader reads each row it will say the header name and the value of the cell instead of just the value of the cell. I'm not sure, there may be support for stuff like that in the other list controls but since I wasn't needing in place editing it still seemed best to go with lightweight repeater where it would render exactly as I specified.

Note that ForumThreadView.aspx doesn't use tables as the actual posts do not seem like tabular data to me.

Cheers,

Joe

9/24/2007 6:44:41 AM
Gravatar
Total Posts 46

Re: GridViews, DataLists, Repeaters

Thanks Joe, I'm using the ForumView.aspx as an example for a page which lists all questions in a surveys page. I like the idea that screen readers will have a better time of the repeater ouput so I'll stick with that. I've built the edit functionality in a seperate page so I'm not really getting anything extra by using a GridView. It's nice to see a good example of stuff like this as it always seems to get overlooked on the projects I've worked on. Again, great work Joe!

Cheers

Rob

9/24/2007 6:56:56 AM
Gravatar
Total Posts 18439

Re: GridViews, DataLists, Repeaters

Hi Rob,

For a list of questions I would ask the question does a row containing a question really fit the paradigm for tabular data? If the answer is yes then a table is appropriate. If not then consider whether it would be better to use an ordered list ol with li elements. I think I would lean toward the ol li approach for that myself. Note that ol is ordered list and that seems exactly the right thing here as opposed to ul which is unordered list. By default ol will render as numbered bullets but don't let that disuade you if you don't like it you can change it in css. The question is whether ol makes the structure of the html more semantically correct to the meaning of the content, it can be styled any way you like with or without numbers indents etc. In this case my impression is that ol is what you want. Of course I say this not having seen what a list of your questions looks like so don't go by just my impression.

Cheers,

Joe

9/24/2007 7:32:21 AM
Gravatar
Total Posts 46

Re: GridViews, DataLists, Repeaters

 

Hi Joe,
Hmmm. Decisions, decisions. Here's a screen print of a list of my questions in a very basic form. It seems like tabular data but then now I'm not sure. What are your thoughts?
www.justsome.net/whattodo.gif

EDIT: The editing fires off to a seperate page.
Cheers
Rob

 

 

9/24/2007 7:38:57 AM
Gravatar
Total Posts 18439

Re: GridViews, DataLists, Repeaters

Hi Rob,

That looks fine to me. What I was picturing was a list of specific questions but without the admin properties. In context of an admin screen with properties in addition to the question itself this looks fine to me and seems tabular enough.

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.