Phone (520) 906-1592
Gary@DeanBlakely.com
Your browser is ClaudeBot Version: 537 :(
Switch Theme:
Go To EditGrid Demo

After having repeated need to provide a variable matrix of input fields, sometimes having to change the matrix dynamically, I decided to develop the EditGrid Control.  The task addressed by this tool has been historically approached by the rendering of custom HTML from server-side code to build a matrix of textboxes and then processing entered results with a combination of client-side and server-side code.  The EditGrid User Control accomplishes this through only server-side processing using standard ASP.Net controls.  This makes the task more productive for both development and maintenance.

The DataGrid and GridView controls are compelling in cases where a variable grid is needed to display information that can be bound from a DataSet or DataTable.  They are also usable controls where editing of data needs to be done in TextBoxes existing in the ItemTemplate but this takes considerable custom coding to complete a solution.

The EditGrid User Control uses a Framework 2.0 GridView control but contains methods, properties, and events to make the dynamic processing of data in edit matrices easy and flexible.  After dropping the EditGrid control onto a page (sometimes within a scrollable div) the EditGrid gets initialized with a call to:

public void BuildMatrix(int NumCols, int NumRows)

There is also an alternative initialization method build the EditGrid from a passed DataTable along with an int to specify extra rows.  Data can then be populated into the grid with calls to:

public void AddValue(string myValue, int col, int row)

Any conceivable formating can be achieved by calling the CustomPresentation method that uses HtmlTextWriterStyle to achieve up to 20 sytles can apply to any individual cell or to set column widths.

Results on what was changed in the EditGrid is provided in two ways. (1) Subscription to a DataChanged event will provide row, col, old Value, and new value for any items that were changed and (2) A call to the GetChangedTable method will return a DataTable with all of the current values.

The demo on the following page will allow you to exercise the EditGrid through a web page that contains the control.