强制在gridview的默认按钮 [英] Forcing Default button on a gridview

查看:91
本文介绍了强制在gridview的默认按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用GridView控件使用模板,以显示和编辑从SQL数据库的一些信息。

I'm using gridview with templates to show and edit some information from a sql database.

当我编辑和更改该行中的数据,然后点击进入,它会自动presses它使用提交给服务器设置为true,这意味着它会试图删除,而不是更新页面上的按钮是最高的。

When I edit and change the data in that row and then click enter it automatically presses the highest on page button which uses submit to server set to true which means it'll try to delete instead of update.

我已经尝试设置面板一轮GridView和设置在面板的默认按钮的updatebutton,但它不会允许,因为它不能'看'的按钮。

I've have tried setting a panel round the gridview and setting the panel's default button to the "updatebutton" but it won't allow that because it can't 'see' the buttons.

推荐答案

我也有类似的问题,我发现了一个很简单的解决方法:

I had a similar problem and I found a very simple workaround:


  1. 将一个按钮在GridView下方,并使其通过CSS无形的(即位置:亲属;左:-2000px)

  2. 创建围绕在GridView一个小组,并给它作为DefaultButton我们刚刚创建的按钮的ID。

  3. 写code为按钮的点击事件的下面一行:
    myGridView.UpdateRow(myGridView.EditIndex,FALSE);

每当你preSS在GridView现在输入,编辑的行将被证实。

Whenever you press enter in the GridView now, the edited row will be confirmed.

这篇关于强制在gridview的默认按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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