View severel rows from database in one gridview-row

I have a database with the columns name, day, activity.

The content look like this:

Peter, monday, work

Alice, Thuesday, London

Alice, Monday, Holiday

 ....

I want to show this in a gridview where each person is shown in one row and the columns are the days of the week. The example above should look like this on the screen:

name, monday, thuesday, wednesday, thursday,...

Peter,work,,,,,,

alice,Holiday, London

Is that possible ?

Thanks

0
sixtus
10/12/2007 6:38:43 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
556 Views

Similar Articles

[PageSpeed] 11

Hi:

  From your description I think you can use ItemTemplate. First just create this layout. The DataSource only have to select distinct name:

name, monday, thuesday, wednesday, thursday,...

Peter

alice

  Namely you just have to add empty columns with different HeaderTemplate. Second step is in ItemDataBound, access DataBase again and manually fill the correct e.Row.Cells[index].Text. About logic you can refer to this. In the sample it uses nested control but in your case you only have to assign value to the relevant TableCell's Text.

http://msdn2.microsoft.com/en-us/library/aa479353(d=printer).aspx

  If your problem isn't solved, please inform us.

Regards


Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Allen
10/15/2007 3:51:50 AM
Reply:

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Error with Gridview when i delete the row that have only one row in gridview
 Dear all, i develop with asp.net 2005 and use gridview and set enable deleteing =true. I can delete record in gridview properly but when gridveiw has only one row and then i'm clike delete button , the error occurs :   Server Error in '/it' Application. Specified argument was out of the range of valid values.Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeExce...

(Fwd) How to loop through a database, row by row, and select and update one row at a time
----- Forwarded message from Troy Mulder <mulderta@gmail.com> ----- Date: Mon, 12 Apr 2010 17:48:37 -0400 From: Troy Mulder <mulderta@gmail.com> To: Tim.Bunce@pobox.com Subject: How to loop through a database, row by row, and select and update one row at a time Hello Tim (is it Dr. Bunce?), My name is Troy Mulder, and I am trying to get a perl script to interface with a PostgreSQL database. I am trying to step through each row of the database, and read one column of the row, and update another column of the row. When I follow the online tutorial a...

Using a row selection in a gridview to create database rows for another gridview
Hi there, I have 2 gridviews on a form, the first displays some template rows from a database table.  The second displays some user specific rows (with additional data added to the template info) from the same table. They both work fine for displaying the info.  Now what I want to do, is allow users to 'select' a template row on the first gridview, and have that action automatically: create a new user-specific row, with added fields from profile data etc. insert it into the table then refresh the second gridview in order to show the new added row. C...

Adding row (one at a time) in gridview on a button click. And cells of added row should contain controls like DROPDOWN LIST or TEXT BOX.
Dear Friends, I am in great need for the solution/hints/guidance of my requirement, if anyone can help with.  Let me explain what I need."I need a Gridview control on a webpage having following 5 columns/fields.     Column 1: It just has a "+" button in its header only (other cells for this column is empty)    Column 2: The Column header here is "FIELD" and  it should contain dropdown list (which is populated from some database)    Column 3: The Column header here is "Operator" and  it should ...

Data Controls insert rows into gridview then insert rows from gridview into SQL Table
Hello there, I'm still new at performing miracles with code . Currently I am having trouble with my latest coding adventure I have a web application which records jobs and labour assigned to jobs. The issue in particular I'm having is the way in which labour is to be assigned. I want to use standard controls (Textbox, Dropdownlist) to record the values into a gridview (ie,put multiple rows into the gridview using the controls). Then, when all the inserting is complete, the user clicks a submit button to insert all the rows from the gridview into a database table. The reason for...

gridview show mulitple rows in one row
I want to show an overview of users, with all classes they have attended and from which year to which year.My userdata is in tblUsers, the info on classes they have been in is stored in tblClassesEach user may have attended 0 to 12 classes.My SQL query returns a row with userdata for each class a user has attended (which is supposed to work like this).Now in my gridview I want to show 1 row PER user and in that same row I want to show all classes that were attended...How can I achieve that?So I might well have 10 rows returned for user Peter, but I want to have one row in my gridview that sh...

returning the database row ID from a selected row from a GridView
Hi I'd like to be able to display a gridView with rows of data, and when the user selects a row, somehow return the ID value for the respective row from the database, not the row in the gridView - if that makes sense. If possible, I don't want the ID displayed in the gridView. Thanks for any helpRichard Use DataKeyNames and SelectedDataKey Property of GridViewSomnath Mali.NET Developer , Pune INDIA.Please Mark As Answer If my reply helped you. I’m not sure what it is your describing; could you elaborate? ThanksRichard 1. <asp:GridView DataKeyNames="ProductID" Al...

Displaying 2 rows as one row in GridView--very urgent
Hi I need to display 2 rows as a one row in Gridview like this in text boxes and also I need horizontal paging on the gridview... any help would be much appreciated !!! ---------------------------------------------------------<<  Jan| Feb| Mar| Apr| May| Jun| Jul|   >>---------------------------------------------------------  A  10 |  20 |  30 |  40 |  50 |  60 |  70 |  B  10 |  20 |  30 |  40 |  50 |  60 |  70 |&...

Gridview Rows stretching in size when one row is returned
HiI hope this is a trival problem.My problem with the gridview is that when one row or only a few rows are returned to the gridview the spacing round the data in the row(s) increases. If there are many more rows, say 10 or more, the spacing is how I want it to be. I have tried setting the spacing for the rows in the properties of the row, but with no luck.Does any one have a way of fixing the row spaces regardless of the number of rows returned? Thanks Hi AndyMoireASP, It seems you have resolved the issue. If so, please post the solution and share with us. Thanks,Qin Dian TangMicro...

ADO.net problem: i can not view image data for the rest of my table rows except the image for the first row but i can read all the other non image fields for all rows.
Hi i have a table with the following fields imgid............int imgdata........image imgtitle.........varchar(max) imgType........varchar(max) imgLength.....bigint incident_id.....int i have no problem with uploading the image but viewing the uploaded image(s) in a gridview has caused me great pain. The probelm is i have two pages. page1 grabs the image to display and page2 has a gridview that displays the grabed image. I wanted to have an sql statement like SELECT * FROM mytable WHERE incident_id=someValue. IF i have 5 records in this table and i view page2 ...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

How to read a dataset one row by one row?
I know you can use DataSet after close sql connection. I want to something after getting dataset, read from one row by one row, just like while datareader.read() Can I read dataset just like this? Thanks in advance! Justin Is this what you're looking for (from the Tips and Tricks Section of ASPNet101.com):http://aspnet101.com/aspnet101/tips.aspx?id=175David WierMCP/ASPInsiderASPNet101.com - where to look first!Control Grouper - easily control properties for multiple controls with one control!Calendar Express - The Best HTML Calendar Generator on the web!(Please 'Mark as Answer&...

Web resources about - View severel rows from database in one gridview-row - asp.net.presentation-controls

Resources last updated: 12/28/2015 7:47:50 AM