0

I have a database and a bound Listview with dynamically created controls. I have been attempting to find a way to capture the new value using markup as

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="ID" OnItemUpdating="ListView1_ItemUpdating">

and code behind as

Protected Sub ListView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewUpdateEventArgs) Handles ListView1.ItemUpdating
    Dim capString As String = String.Empty
    capString = e.NewValues
 End Sub

This fails with the error Unable to cast object of type 'System.Collections.Specialized.OrderedDictionary' to type 'System.String'

I'm hoping someone could help me identify either a better way to accomplish capturing this data, or if it is possible to cast this data and how to do it in code.

4

1 回答 1

1

尝试

Dim capString As String = String.Empty 
capString = e.NewValues(1) As String

将 1 替换为您的 capString 的适当索引。

于 2013-08-27T14:25:48.137 回答