Skip to content

Add DataGrid component#314

Merged
csharpfritz merged 5 commits intodevfrom
copilot/add-datagrid-component
Jan 30, 2026
Merged

Add DataGrid component#314
csharpfritz merged 5 commits intodevfrom
copilot/add-datagrid-component

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

Implements DataGrid control for compatibility with ASP.NET 1.x Web Forms applications during migration. While superseded by GridView in ASP.NET 2.0, DataGrid remains widely used in legacy systems.

Implementation

  • Component: DataGrid with auto-column generation, manual column definition, header visibility, and empty data text support
  • Column Types: Reuses GridView's BoundField, ButtonField, HyperLinkField, and TemplateField
  • Event Model: Uses "Item" prefix (OnItemCommand, OnEditCommand) vs GridView's "Row" prefix for Web Forms compatibility
  • API Differences: DataKeyField (singular) vs GridView's DataKeyNames (plural)

Usage

<DataGrid ItemType="Customer"
          AutoGenerateColumns="false"
          DataKeyField="CustomerID"
          SelectMethod="GetCustomers"
          EmptyDataText="No data available">
    <Columns>
        <BoundField ItemType="Customer" DataField="CustomerID" HeaderText="ID" />
        <BoundField ItemType="Customer" DataField="CompanyName" HeaderText="Company" />
        <ButtonField ButtonType="ButtonType.Button" 
                     CommandName="Edit" 
                     Text="Edit" />
    </Columns>
</DataGrid>

Testing & Documentation

  • 4 bUnit tests covering data binding, auto-generation, empty states, and header control
  • 3 sample pages demonstrating component features (Default, Auto-Generated Columns, Show/Hide Header)
  • Integration tests for all DataGrid sample pages
  • Comprehensive migration guide comparing DataGrid vs GridView
  • DataGrid added to navigation tree and home page component list
  • Status: Data Controls now 6/8 complete (75%)

Screenshots

Home page with DataGrid in component list:

Home page

Navigation tree with DataGrid:

Navigation tree

DataGrid sample page:

DataGrid sample

Original prompt

This section details on the original issue you should resolve

<issue_title>Add DataGrid Componant</issue_title>
<issue_description>Would be great if you can add a DataGrid support as we were using it heavily in our system or if there is an easy swappable already implemented component.

Sample ASPX code:

<asp:DataGrid ID="dgCountries" CellSpacing="2" CellPadding="1" runat="server" EnableViewState="true" CssClass="table"
BorderWidth="0px" BorderStyle="None" DataKeyField="COUNTRY_ID" OnDeleteCommand="deleteCountry"
AllowSorting="false" AutoGenerateColumns="false">




<asp:TemplateColumn HeaderText="Country">


<asp:Label runat="server" Text='<%# htmlEncode(Container.DataItem, "COUNTRY_NAME")%>' ID="lblCountry">
</asp:Label>

</asp:TemplateColumn>
<asp:ButtonColumn HeaderStyle-Width="30" ItemStyle-CssClass="iconCell" Text="<i class='deleteIcon' alt='Delete' title='Delete'> </i>"
CommandName="Delete"></asp:ButtonColumn>

</asp:DataGrid>
</issue_description>

<agent_instructions>Create a DataGrid component using techniques similar to our GridView. Be sure to create docs, samples, integrations tests, and update the status.md file</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 29, 2026 20:40
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add DataGrid component for system support Add DataGrid component Jan 29, 2026
Copilot AI requested a review from csharpfritz January 29, 2026 20:47
@csharpfritz
Copy link
Copy Markdown
Collaborator

@copilot Add the DataGrid to the samples navigation tree and the samples home page list of controls

Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot Add the DataGrid to the samples navigation tree and the samples home page list of controls

Added in commit c17ba19:

  • Navigation tree now includes DataGrid with sub-pages (Default, Auto-Generated Columns, Show/Hide Header)
  • Home page component list now includes DataGrid link in Data Controls section
  • Integration tests updated to include all DataGrid sample pages

Screenshots:

Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
@csharpfritz csharpfritz marked this pull request as ready for review January 30, 2026 04:02
@csharpfritz csharpfritz merged commit 5227425 into dev Jan 30, 2026
2 checks passed
@csharpfritz csharpfritz deleted the copilot/add-datagrid-component branch January 30, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add DataGrid Componant

2 participants