473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1876
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
7673
by: Billy Jacobs | last post by:
I am using a datagrid to display some data. I need to create 2 header rows for this grid with columns of varying spans. In html it would be the following. <Table> <tr> <td colspan=8>Official Impact Summary</td> </tr> <tr> <td colspan=2></td>
0
1985
by: Gamze | last post by:
Hi, How can i get values from datagrid to combobox and should select the same name as in datagrid row on the combobox control In my vb.net windows application ,i have combobox which is populated by sqlserver database table.When i select value from combobox ,value saved in to other table of my database and i use to datagrid to show...
3
2534
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would...
3
3903
by: Quetzal | last post by:
Hello, I have a dataset populated using an XML file. The schema has hierarchical components. Let's say <a><b></b></a>. I have created a datagrid and I have assigned a datastyle and then gridcolumnstyle for all columns at the parent level. I have created a datastyle for every child level and I have assigned also gridcolumn styles to the...
6
3313
by: Alpha | last post by:
I have several textboxes that I need to chang the text when the selection row is changed in a datagrid. I have the following code. This textbox displayes the initial selection but when I click on different rows in the datagrid, the textbox content doesn't change to reflect the change. How can I address this? Also, If the user change the...
5
12225
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate...
3
4866
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
8
3041
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the client-side coding needed for the user to click a "select" button (HTMLButton) in column 0 of the datagrid and have the table objects auto-fill with...
2
2023
by: Marty McDonald | last post by:
When setting certain datagrid properties with the IDE (as in the property window), they don't seem to take effect. For instance, Font Name. So I have to set these via code-behind at the cell level. Is this expected? Shouldn't anything on the properties window render accordingly? Thanks
4
4526
by: jaYPee | last post by:
I have 1 dataset called "dataset1" that contains 2 tables called "course" and "courseload". in my form i have a datagrid. the datasource of this datagrid is "dataset1" and the datamember is "courseload". here's the fields of every table in my dataset. "Course" table CourseID
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8216
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.