如何从RadTreeList UpdateCommand中找到DataKeyValue?
当我进行更新时,我到底如何找到 DataKey?我已经尝试了一切...
Private Sub rtlAccounts_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.TreeListCommandEventArgs) Handles rtlAccounts.UpdateCommand
Dim txtAccountDescription As RadTextBox = TryCast(e.Item.FindControl("txtAccountDescription"), RadTextBox)
Dim txtAdminName As RadTextBox = TryCast(e.Item.FindControl("txtAdminName"), RadTextBox)
Dim txtAdminEmail As RadTextBox = TryCast(e.Item.FindControl("txtAdminEmail"), RadTextBox)
Dim rcbStatus As RadComboBox = TryCast(e.Item.FindControl("rcbStatus"), RadComboBox)
Dim rntDocRetention As RadNumericTextBox = TryCast(e.Item.FindControl("rntDocRetention"), RadNumericTextBox)
Dim item As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
Dim MyDataKeyID As String = 'Now what???
End Sub
还想知道如何从 InsertCommand 和 UpdateCommand 中找到 ParentDataKeyValue 。
How on earth do I find the DataKey when I'm doing an update? I've tried everything...
Private Sub rtlAccounts_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.TreeListCommandEventArgs) Handles rtlAccounts.UpdateCommand
Dim txtAccountDescription As RadTextBox = TryCast(e.Item.FindControl("txtAccountDescription"), RadTextBox)
Dim txtAdminName As RadTextBox = TryCast(e.Item.FindControl("txtAdminName"), RadTextBox)
Dim txtAdminEmail As RadTextBox = TryCast(e.Item.FindControl("txtAdminEmail"), RadTextBox)
Dim rcbStatus As RadComboBox = TryCast(e.Item.FindControl("rcbStatus"), RadComboBox)
Dim rntDocRetention As RadNumericTextBox = TryCast(e.Item.FindControl("rntDocRetention"), RadNumericTextBox)
Dim item As TreeListEditableItem = TryCast(e.Item, TreeListEditableItem)
Dim MyDataKeyID As String = 'Now what???
End Sub
Also would like to know how to find the ParentDataKeyValue from an InsertCommand and the UpdateCommand as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要获取 DataKeyValue 和 ParentDataKeyValue,请将最后两行更改为以下内容:
Per Telerik 的文档,如果您使用 InPlace 编辑模式,您应该将
TreeListEditableItem
转换为TreeListDataItem
;如果您使用 EditForms,则应将TreeListEditableItem
转换为TreeListEditFormItem
。为了让 GetDataKeyValue 和 GetParentDataKeyValue 返回您想要的值,您必须在定义 RadTreeList 时在各自的 DataKeyNames 和 ParentDataKeyNames 值中设置它们:
To get the DataKeyValue and the ParentDataKeyValue, change your last two lines to the following:
Per Telerik's documentation, if you are using InPlace edit mode you should cast the
TreeListEditableItem
to aTreeListDataItem
; if you are using EditForms you should cast theTreeListEditableItem
to aTreeListEditFormItem
.In order for GetDataKeyValue and GetParentDataKeyValue to return the values you want, you must set them in the respective DataKeyNames and ParentDataKeyNames values when defining a RadTreeList: