ASP.net Edit "cell" in GridView

Murray Brown
Murray Brown used Ask the Experts™
on
Hi

In my ASP.net web app a user selects a from and to date and a datatable loads into a GridView with a column
for each date. I want a user to be able to select one of the items or "cells" in the gridview and change the number in it.
Ordinarily I use template columns to do this because I know exactly which columns will load but in this
case any number of date columns can load.

1
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Lansing Nye-MaddenNetwork Administrator

Commented:
How do you go about generating the columns? Are they created individually, one-at-a-time, or are they part of a larger data set schema?
Murray BrownASP.net/VSTO Developer

Author

Commented:
I generate the columns individually or one at a time at the line marked "HERE"

    Dim dtNew As New DataTable()
        'Dim dtLineIDs As New DataTable() 'hidden LineID values
        dtNew.Columns.Add("EmployeeID")
        dtNew.Columns.Add("EmployeeName")
        For i As Integer = 0 To UBound(arrDates) 'Loop through and add date columns
            oDateColumn = arrDates(i).ToString("dd MMM yyyy")
            dtNew.Columns.Add(oDateColumn) "HERE
            oLineIDColumn = "LineID " & oDateColumn 'Hidden Line ID values
            dtNew.Columns.Add(oLineIDColumn)
        Next i

Open in new window

Developer User Interface
Commented:
How do u enable editing for the cell?

Can you handle the RowDatabound event of the gridview and add a click event for each of the cells?

https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.gridview.rowdatabound
Murray BrownASP.net/VSTO Developer

Author

Commented:
Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial