Answered by:
Looking for a control similar to excel inside aspx

Question
-
User248267340 posted
I'm learning some of the data controls for aspx forms. What I'm trying to accomplish is emulate a Windows App that has a GridView for user data input. You know, the classic Excel type of appearance and usage.
So in aspx, is there a control that just allows data input into the grid, easily? Something very basic, as if you had a small Excel form right there in the body of the aspx page!
Any suggestions?
Wednesday, September 30, 2020 5:18 PM
Answers
-
User409696431 posted
A GridView renders as a Table. CSS on a table would give you the same issues as for a GridView. For example, you can't resize a table column to be smaller than the largest entry in that column plus any padding (defined or defaulted by the browser).
A GridView comes built in with the ability to display a grid of data and edit the data in that grid, but doing only one row at a time.
If you want the GridView to be all editable at once, not one row at a time, you can do that, but it requires you to write your own code to set all the rows in edit mode, and your own code to iterate through all the GridView rows and update the database rather than using the GridView's built in one-row-at-a-time "update". There are examples all over the web on how to do this.
Similarly if you are looking for an empty grid to add new data, not to update existing data, that can also be done by a GridView, but again, you have to write your own code to iterate through the cells and insert the rows into the database.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, October 1, 2020 2:45 AM
All replies
-
User-1330468790 posted
Hi coreysan,
There are indeed some spreadsheet controls for ASP.NET however they are not for free (just the opposite, a bit expensive).
For example,
https://www.syncfusion.com/jquery/aspnet-web-forms-ui-controls/spreadsheet
https://demos.devexpress.com/ASPxSpreadsheetDemos/
If you need to use excel-like control, a feasible way is to use grid view and manually add functionalities on it.
At least, you are able to implement followings:
- import data and display them. (https://forums.asp.net/t/1913189.aspx?Import+data+from+Excel+OpenDocument+Spreadsheet+to+gridview)
- export data from the table. (https://stackoverflow.com/questions/17047296/export-grid-view-to-excel)
Hope this can help you.
Best regards,
Sean
Thursday, October 1, 2020 2:04 AM -
User248267340 posted
Thanks Sean. I appreciate your advice. I tried working with the gridview, and adjusting the width of columns was harder than I thought,
for some reason. And when I tried to rezize the width below 30px it wouldn't respond. SO on that score, it's an uphill battle.
But if that's the only meaningful control I can use (for free) then I guess that's it.
Do you think I should suck it up and work with it, or try a native table?
Thursday, October 1, 2020 2:22 AM -
User409696431 posted
A GridView renders as a Table. CSS on a table would give you the same issues as for a GridView. For example, you can't resize a table column to be smaller than the largest entry in that column plus any padding (defined or defaulted by the browser).
A GridView comes built in with the ability to display a grid of data and edit the data in that grid, but doing only one row at a time.
If you want the GridView to be all editable at once, not one row at a time, you can do that, but it requires you to write your own code to set all the rows in edit mode, and your own code to iterate through all the GridView rows and update the database rather than using the GridView's built in one-row-at-a-time "update". There are examples all over the web on how to do this.
Similarly if you are looking for an empty grid to add new data, not to update existing data, that can also be done by a GridView, but again, you have to write your own code to iterate through the cells and insert the rows into the database.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Thursday, October 1, 2020 2:45 AM -
User248267340 posted
Kathy,
I think you expressed it best. It turns out my boss suggested writing a for loop and generate a series of text boxes for our needs.
Seems to be the least path of resistance! I also think you convinced me to suck it up and really get to know GridView!
Thanks so much, both to you and to Sean.
Thursday, October 1, 2020 6:05 PM