我们如何使用boundfield使用datakeys更新gridview [英] how can we update gridview with out using datakeys using boundfield
本文介绍了我们如何使用boundfield使用datakeys更新gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我的问题是我有一个不包含主键的表,我将这个表绑定到网格视图,它的工作完美。现在我需要使用boundfield更新gridview而不使用datakeys。
所以请建议我们合适的代码。
Hello,
My problem is i have table which doesn't contain primary key and i am binding this table to grid view its working perfectly. now i need to update gridview using boundfield without datakeys.
so please suggest us suitable code.
推荐答案
如果你没有DataKey
,然后你需要将密钥存储在Row内某处的HiddenField
或BoundField
或其他什么。
然后在 GridView.RowUpdating事件 [ ^ ],找到该字段并检索该值。之后使用键
或Id
对您的数据库运行查询。
If you don't haveDataKey
, then you need to store the Key somewhere inside the Row either in aHiddenField
orBoundField
or something.
Then inside GridView.RowUpdating Event[^], find that field and retrieve the value. After that run a Query on your Database using thatKey
orId
.
这篇关于我们如何使用boundfield使用datakeys更新gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文