471,321 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

datagrid or table?

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

Jan 18 '06 #1
6 1833
What about using a repeater control?

Jan 18 '06 #2
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ro**************@gmail.com" wrote:
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

Jan 18 '06 #3
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

Jan 18 '06 #4
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?

Jan 18 '06 #5
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?

Jan 18 '06 #6
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"bob" wrote:
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?

Jan 18 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Billy Jacobs | last post: by
reply views Thread by Gamze | last post: by
5 posts views Thread by John Richardson | last post: by
3 posts views Thread by Jim Heavey | last post: by
2 posts views Thread by Marty McDonald | last post: by
4 posts views Thread by jaYPee | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.