在GridView的ASP.NET配置更新按钮 [英] ASP.NET Configure update button in GridView

查看:153
本文介绍了在GridView的ASP.NET配置更新按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS2005 C#ASP.NET。

我有一个GridView表,但有一个选择不的启用修改的,当我右键单击的智能标签的。

因此​​我手动用以下code添加的编辑按钮

AutoGenerateEditButton属性=真

Edit按钮已经成功地出现在我的GridView是这样的:

当我点击的修改的按钮时,页面被刷新,该行现在是可编辑的:

然而,当我pssed上的更新按钮$ P $,我被带到了错误:

更新不受数据源SqlDataSource1除非指定更新命令支持。


http://i.stack.imgur.com/W97K0.png

我有我怎么能输入或配置任何线索的更新命令,因为我没有看到任何背景code为更新按钮。

需要帮助的经历。谢谢你在前进。


编辑:在 SqlDataSource1 ,但是我还是当我preSS的更新遇到了同样的错误增加了INSERT查询按钮。


解决方案

您需要重新配置 SqlDataSource1 控制虽然可以在其中添加了<$ C $支持C> INSERT ,删除更新> SELECT

看看<一个href=\"http://www.asp.net/data-access/tutorials/inserting-updating-and-deleting-data-with-the-sqldatasource-vb\"相对=nofollow>这个教程。

I am using C# ASP.NET on VS2005.

I have a gridview table but it does not have a selection for Enable Editing when I right click on the Smart Tab.

Thus I manually added the edit button with the following code:

AutoGenerateEditButton="True"

The edit button has successfully appeared on my gridview like this:

When I click on the Edit button, the page is refreshed and the row is now editable:

However, when I pressed on the update button, I was brought to the error:

Updating is not supported by data source 'SqlDataSource1' unless UpdateCommand is specified.

http://i.stack.imgur.com/W97K0.png

I have no clue on how I can input or configure the UpdateCommand because I don't see any background code for the Update button.

Need help from experienced. Thank you in advance.


Edited: Added INSERT query in SqlDataSource1, however I still met the same error when I press the Update button.

解决方案

You need to re-configure the SqlDataSource1 control though which you can add support for INSERT, DELETE, UPDATE along with SELECT.

Take a look at this tutorial.

这篇关于在GridView的ASP.NET配置更新按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆