Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Using ASP.NET Web Form (and C#) I need to display sum of hours worked grouped by Phase Description, Task Description, and Timekeeper. The client would then like to be able to edit, drag/drop line items within the grid/table displayed on the web page.

The problem I have is how to create a gridview/listview/datarepeater or some other control that provides editing (updating a database table record) and drag/drop functionality.

The database would look like:

ItemId PhaseDescription TaskDescription TimeKeeperId HoursWorked EmployeeName
20 Phase Nine Task Four 3090 11.5 Bartholo, Lauren
15 Phase Nine Task Ninety Two 3232 7.3 Anderson,Martha
1 Phase One Task One 3338 1 Arinist, Daniel
19 Phase One Task One 3090 60 Bartholo, Lauren
5 Phase One Task Seven 1930 10.8 VandenKirk, David
16 Phase One Task Thirteen 831 10 Cunningham, Lawrence

The SQL PIVOT Data looks like this

PhaseDescription TaskDescription Amelia Vincent Lawrence Cunningham Sal Bitumous David VandenKirk Lauren Bartholo Martha Anderson Daniel Arinist Total Hours Total Fees
Phase Nine Task Four NULL NULL NULL NULL 11.5 NULL NULL 11.5 0
Phase Nine Task Ninety Two NULL NULL NULL NULL NULL 7.3 NULL 7.3 0
Phase One Task One NULL NULL NULL NULL 60 NULL NULL 61 650
Phase One Task One NULL NULL NULL NULL NULL NULL 1 61 650
Phase One Task Seven NULL NULL NULL 10.8 NULL NULL NULL 10.8 0

What I have tried:

At this point I have been able to return my data using a SQL PIVOT table, and create my group totals within C#, but I can’t seem to come up with a way to actually edit the cell data in the UI, and using the unique key for that cell (corresponding to a primary key in the database table) update the database. The DataKeyName Field for the row does not work at all in the GridView, and since each row may have 1-10 columns, and each may have hours reported I have the potential for 1-10 primary keys on that row update.


Additionally I can return the flat data from SQL and create a pivoted table to display within the grid view – but once again I do not see a way to edit/drag and drop the cell contents.

Any ideas would be greatly appreciated on how to accomplish my client’s request.

I’m wondering if there are any other controls that would accomplish this……or some way to create the grid programmatically without using a pivoted data source.

I am using VS2013, SQL 2012, and ASP.NET C# 4.5
Posted
Comments
ZurdoDev 12-Jan-18 9:28am    
It sounds like your first issue is to find a control that allows you to do what you want. All your db design, etc, is not relevant. There are many controls that allow drag and drop and there is also a jquery ui drag and drop plugin to add drag/drop to any control. I'm not sure how to get it to work in a grid though.

So, first decide what kind of control you need and go from there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900