S
shapper
Hello,
I am creating, at runtime, a ListView with a LinqDataSource.
I am able to display the data but when I try to delete a record I get
the following error:
"Row not found or changed."
Here is my code (ldsTags is the LinqDataSource and lvTags is the
ListView):
Private Sub ldsTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles ldsTags.Init
With ldsTags
.ContextTypeName = "MyDatabaseDataContext"
.EnableDelete = True
.EnableInsert = True
.EnableUpdate = True
.ID = "ldsTags"
.TableName = "Tags"
End With
End Sub ' ldsTags_Init
Private Sub ldsTags_Selecting(ByVal sender As Object, ByVal e As
LinqDataSourceSelectEventArgs) Handles ldsTags.Selecting
Dim database As New MyDatabaseDataContext
Dim tags = From t In database.Tags _
Select t.TagID, _
t.Text, _
Active = t.FilesTags.Any Or t.ArticlesTags.Any
e.Result = tags
End Sub ' ldsTags_Selecting
Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
With lvTags
.DataKeyNames = New String() {"TagID"}
.DataSourceID = "ldsTags"
.EditItemTemplate = New
ListViewLabTemplate(TemplateType.EditItemTemplate)
.ID = "lvTags"
.ItemTemplate = New
ListViewLabTemplate(TemplateType.ItemTemplate)
.LayoutTemplate = New
ListViewLabTemplate(TemplateType.LayoutTemplate)
End With
End Sub ' lvTags_Init
Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Load
lvTags.DataBind()
End Sub ' lvTags_Load
What am I missing?
Thanks,
Miguel
I am creating, at runtime, a ListView with a LinqDataSource.
I am able to display the data but when I try to delete a record I get
the following error:
"Row not found or changed."
Here is my code (ldsTags is the LinqDataSource and lvTags is the
ListView):
Private Sub ldsTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles ldsTags.Init
With ldsTags
.ContextTypeName = "MyDatabaseDataContext"
.EnableDelete = True
.EnableInsert = True
.EnableUpdate = True
.ID = "ldsTags"
.TableName = "Tags"
End With
End Sub ' ldsTags_Init
Private Sub ldsTags_Selecting(ByVal sender As Object, ByVal e As
LinqDataSourceSelectEventArgs) Handles ldsTags.Selecting
Dim database As New MyDatabaseDataContext
Dim tags = From t In database.Tags _
Select t.TagID, _
t.Text, _
Active = t.FilesTags.Any Or t.ArticlesTags.Any
e.Result = tags
End Sub ' ldsTags_Selecting
Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
With lvTags
.DataKeyNames = New String() {"TagID"}
.DataSourceID = "ldsTags"
.EditItemTemplate = New
ListViewLabTemplate(TemplateType.EditItemTemplate)
.ID = "lvTags"
.ItemTemplate = New
ListViewLabTemplate(TemplateType.ItemTemplate)
.LayoutTemplate = New
ListViewLabTemplate(TemplateType.LayoutTemplate)
End With
End Sub ' lvTags_Init
Private Sub lvTags_Load(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Load
lvTags.DataBind()
End Sub ' lvTags_Load
What am I missing?
Thanks,
Miguel