如何更新ASP.NET GridView的ReadOnly字段? [英] How to update ASP.NET GridView's ReadOnly fields?
问题描述
我一直在尝试使用.Net的GridView控件.
我使用ObjectDataSource,并尝试使用Update.
如果我不对gridview进行任何更改,则更新工作正常.但是,当我将其中一个字段设置为ReadOnly时,会出现错误.
我有一个TimeStamp字段,它保存记录的最后更新时间,因此我必须将其设置为对用户只读,并使用System.DateTime.Now值对其进行更新.
有没有办法设置该值?
预先感谢,
codddy
Hi,
I have been trying to use the GridView control of .Net.
I use the ObjectDataSource, and try to use the Update.
If I don''t make any changes to the gridview the Update is working correctly. But when I set one of the fields to ReadOnly it gives error.
I have a TimeStamp field which holds the last update time of the record, so I have to make it ReadOnly to the user and also update it with System.DateTime.Now value.
Is there a way to set this value?
Thanks in advance,
codddy
推荐答案
嗨
您可以从服务器端设置只读属性
Hi
You can set readonly attribute from server side
txtValidTill.Attributes.Add("readonly", "readonly");
如有任何疑问,请让我知道.
请提供"投票":thumbsup:如果有帮助,请提供"接受答案",如果这是正确的答案.:rose:
谢谢,
Imdadhusen
Please do let me know, if you have any doubt.
Please provide "Vote":thumbsup: if this would be helpful, and make "Accept Answer" if this would be correct answer.:rose:
Thanks,
Imdadhusen
这篇关于如何更新ASP.NET GridView的ReadOnly字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!