将数据从SQL表加载到网格视图并使其可编辑。

问题描述:

嗨亲爱的,



由于这个原因,我被困在项目中间。实际上我有一个SQL表,我希望我的C#代码动态加载到gridview。我使用一个简单的选择查询。所以现在我想让gridview可编辑。每次我的表名根据用户选择而改变,所以我不会在Sqldatasource的帮助下寻找任何手动活动。



我想要一个正确的方法让我的Gridview可编辑。



请给我推荐一下。



我尝试了什么:



直到现在我能够在gridview中绑定我的sql表,我可以看到绑定列中的所有值。想要在所有行前面有一个编辑选项,并使行可编辑。

Hi Dears,

I am stuck in the middle of my project due to this. Actually i have a SQL table and i want my C# code to dynamically load into gridview. This i have done using a simple select query. SO now i want to make the gridview is editable. Every time my table name changes as per user selection, so i am not looking for any manual activities with the help of Sqldatasource.

I want a proper way to make my Gridview editable.

Please suggest me something.

What I have tried:

Till now i can able to bind my sql table in gridview, I can see all the values in bound column. Want an edit option in front of all the rows and make the rows editable.

正如您所说的gridview我假设您正在使用ASP .NET。



GridView内置了一个编辑选项 - 请参阅文档 ASP.NET 2.0的GridView示例:编辑GridView中的基础数据 [ ^ ]
As you are referring to a "gridview" I'm assuming you are using ASP.NET.

The GridView has an edit option built in - see the documentation GridView Examples for ASP.NET 2.0: Editing the Underlying Data in a GridView[^]