Gridview row having multiple record
I have a s开发者_如何转开发tored procedure that retrieves employee information - I don’t want to edit this stored procedure because it is globally use with in the website.
Here is now my dilemma, how can I put multiple row records in a column in the grid view. Is Gridview powerful enough to my scenario below or I really need to edit the stored procedure or my copy of it. Thanks
Records retrieve by stored procedure
Employee_ID Purchase ID Amount
1 0123456 100
1 012356 560
1 012446 560
1 012126 560
2 011122 100
2 051122 200
I want to achieve this in gridview
Employee ID Purchase ID Total Amount
-----------------------------------------
1 012345 1780
012346
012446
012126
2 011122 3000
051122
You could create a new stored procedure for use with this gridview only, leaving your existing stored procedure as-is so it doesn't break other parts of your code.
Alternatively, if you don't want to create a new stored procedure, you could sum the totals in your vb code, although it will be more work than doing it at the DB level. You'd do this using the gridview's datasource, not the gridview itself.
You can add a template column, and start it with (I believe) an </td></tr><tr><td>
In any case, each gridview template column implicitly (you can't see it) renders open/close td tags around whatever you put in it.
精彩评论