更新后,Gridview模式不会更改回Readonly [英] Gridview mode not changing back to Readonly after Update

查看:65
本文介绍了更新后,Gridview模式不会更改回Readonly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,


我在使用Gridview控件时出现问题在我的asp.net/C#应用程序中。它包含一些boundFields和一个checkbox字段。我的gridview允许编辑。它成功进入编辑模式,当我点击更新数据源更新但控件不会返回只读模式。我已经走得足够远,可以找出问题是由Checkbox字段引起的。复选框工作并将正确的true / false值传递给数据源但是在更新后不会绑定当我将其设为readonly并从我的存储过程中删除该值时Gridview控件正常工作。请帮忙。

解决方案

我不明白你在做什么。


你有一个GridView,有一个复选框字段。

你在网格视图中编辑一条记录并更新数据库。


现在你在做什么?


有什么问题?


通常当你有一个Gridview而不是可以编辑的时候,你点击编辑按钮,所有可编辑的字段变成Textboxes,Checkbox是启用。我更改了值并单击更新,但gridview仍处于编辑模式,而不是返回到Readonly并显示新结果。如果我点击取消网格更改模式,我看到新的值。通常,gridview会在更新后返回readonly。我发现这个问题是由Checkbox字段引起的。一旦我从gridview中删除了这个字段就行了(来回更改模式)是否有一个替代复选框将返回true / false?


一旦你完成更新了你试过将GridView的EditIndex属性设置为-1?


喜欢(vb):

展开 | 选择 | Wrap | 行号

Hello All,

I am having Trouble with a Gridview control In my asp.net/C# application. It contains Some boundFields and one checkbox field. My gridview allows Editing. It succesfully enters edit mode and when i hit update the Datasource updates but the control will not return to readonly mode. I have gone far enough to figure out the problem is caused by the Checkbox field.The checkbox works and passes the correct true/false value to the datasource but will not bind after update When I Make it readonly and remove that value from my Stored Procedure the Gridview control works normal. Please help.

解决方案

I don''t understand what you''re doing.

You have a GridView that has a checkbox field.
You Edit a record in the Grid view and update the database.

Now what what are you doing??

What is the problem?


Usually when you have a Gridview than can be edited you click the edit button and all the editable fields become Textboxes and the Checkbox is Enabled. I change the values and click update but the gridview stays in Edit mode instead of canging back to Readonly and displaying the new results. If i hit cancel the Grid changes modes and i see the new values. Usually the gridview returns to readonly after update''s. I figured out this problem is caused by the Checkbox field . Once i remove this field from my gridview it works (changes modes back and forth) Is there an alternative to the Checkbox that will return true/false?


Once you''re finished updating have you tried setting the GridView''s EditIndex property to -1?

Like (vb):

Expand|Select|Wrap|Line Numbers


这篇关于更新后,Gridview模式不会更改回Readonly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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