I'm trying to use DataGrid in ASP.NET, but I can't edit it.

Asked 2 years ago, Updated 2 years ago, 413 views

I have to use ItemTemplate, but it's my first time using it, so I'm not sure.
Also, it is displayed.

The reason I use DataGrid is because I want to create and modify the data and save it.
Also, I think GridView cannot be changed.

environment:
VisualStudio 2019
FrameWowk 4.7.2
Windows 10

<asp:DataGridID="DataGrid1" runat="server" AutoGenerateColumns="False" width="577px"Height="183px">
    <Columns>
        <asp:BoundColumn HeaderText="Date" DataField="YMD">
            <HeaderStyle Width="100px"/>
        </asp:BoundColumn>
        <asp:BoundColumn HeaderText="Distributor" DataField="TKCD">
            <HeaderStyle Width="100px"/>
        </asp:BoundColumn>
    </Columns>
    <HeaderStyle BackColor="Lime" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Underline="False" HorizontalAlign="Center" VerticalAlign="Middle;
</asp:DataGrid>

asp.net

2022-09-30 21:59

1 Answers

DataGrid was designed at .NET Framework 1.1:00 (2003), but was redesigned at .NET Framework 2.0:00 (2005) due to its old and inflexible design.If you don't have any particular reason, you should consider GridView.

From DataGrid/Remarks

Before you use the DataGrid control, consumer using the GridView control installed.The GridView control, which was introduced in the .NET Framework version 2.0, is the successor to the DataGrid control.


2022-09-30 21:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.