Tuesday 27 August 2013

Listview - Capture text from dynamically created textbox on Update

Listview - Capture text from dynamically created textbox on Update

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.

No comments:

Post a Comment