سؤال

كيف يمكنني العثور على Datakey عند إجراء تحديث؟لقد جربت كل شيء ... giveacodicetagpre.

ترغب أيضا في معرفة كيفية العثور على ParentDatakeyValue من InsertCommand و UpdateCommand أيضا.

هل كانت مفيدة؟

المحلول

To get the DataKeyValue and the ParentDataKeyValue, change your last two lines to the following:

Dim editedItem As TreeListEditFormItem = CType(e.Item, TreeListEditFormItem)
Dim dataKeyValue As String = _
    editedItem.ParentItem.GetDataKeyValue("EmployeeID").ToString()
Dim parentDataKeyValue As String = _
    editedItem.ParentItem.GetParentDataKeyValue("ReportsTo").ToString()

Per Telerik's documentation, if you are using InPlace edit mode you should cast the TreeListEditableItem to a TreeListDataItem; if you are using EditForms you should cast the TreeListEditableItem to a TreeListEditFormItem.

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:

<telerik:RadTreeList ID="EmployeeTreeList" runat="server" 
    DataKeyNames="EmployeeID" 
    ParentDataKeyNames="ReportsTo">
    <Columns>
        <%-- Add column definitions here --%>
    </Columns>
</telerik:RadTreeList>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top