datagrid or table?

R

robert.colclough

Hi

I'm trying to write a program that seraches from strings in various
text files and displays the data in an easy on the eye tabular form on
a webpage. I have written all of the code to search through the files
in question but I need a bit of help on how to display them.

The datagrid on the face of it seems an ideal solution but as its
primary use is databinding it with a data source I'm having a lot of
trouble manually adding items into the control as I am not using any
kind of database I basically have a selection of strings which i want
to put into the datagrid as one row then repeat the operation.

Any ideas on how i would do this?

Or if this is not the way that datagrids are meant to be used, got any
tips for using tables? It seems like there is a lot of code to create
each row, cell etc

Thanks in advance
 
G

Guest

Robert,
You are correct in your statement that the DataGrid is happiest when it is a
databound animal. You can create a datatable with the appropriate columns and
bind this to the grid.

Or, you might find that a DataList is more appropriate as it lets you
customize the HTML in ItemTemplates and still have the repeating feature.

Finally, you just might decide to create a custom HTML table instead, which
is certainly a valid choice, although it may take a lot more code.

--Peter
 
B

bob

Maybe in the future i would like to add a the check box column in that
think is available in a datagrid. So if the datagrid option is possible
i would prefer to persue that first.

Cheers
 
B

bob

So am I right in thinking that I have to create a source, wheter it be
a database or other datatable first before binding it to the datagrid,
and it is not possible to add many items to it directly?
 
B

bob

So am I right in thinking that I have to create a source, wheter it be
a database or other datatable first before binding it to the datagrid,
and it is not possible to add many items to it directly?
 
G

Guest

That's right. Anything that implements the IList interface is bindable. But,
a DataTable is probably the most flexible because it offers DataView,
sorting, Select, and other features. You can build a DataTable manually, it
is not necessary to get data from a database to create one.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top