Hi Shapper
Please.. could you write a little more code....we can help you
better
Example.. how do you bind a ObjectDataSource with data?? wich
webcontrol?
______________________
Jose A. Fernandez
blog:
http://geeks.ms/blogs/fernandezja
Hi,
I am using an ASP.NET 3.5 ListView. Here is the code I am using:
ListView
Private Sub lvTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles lvTags.Init
With lvTags
.DataKeyNames = New String() {"TagID"}
.DataSourceID = "odsTags"
.ID = "lvTags"
.InsertItemPosition = InsertItemPosition.FirstItem
End With
' Define templates
With lvTags
.EditItemTemplate = New
TagsTemplate(TemplateType.EditItemTemplate)
.InsertItemTemplate = New
TagsTemplate(TemplateType.InsertItemTemplate)
.ItemTemplate = New TagsTemplate(TemplateType.ItemTemplate)
.LayoutTemplate = New
TagsTemplate(TemplateType.LayoutTemplate)
End With
End Sub
ObjectDataSource
Private Sub odsTags_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles odsTags.Init
' Define properties
With odsTags
.ID = "odsTags"
.DeleteMethod = "Delete"
.InsertMethod = "Insert"
.SelectMethod = "SelectAll"
.TypeName = "TagsManager"
.UpdateMethod = "Update"
End With
odsTags.DeleteParameters.Add(New Parameter("TagID",
TypeCode.Object))
odsTags.InsertParameters.Add(New Parameter("Text",
TypeCode.String))
odsTags.UpdateParameters.Add(New Parameter("TagID",
TypeCode.Object))
odsTags.UpdateParameters.Add(New Parameter("Text",
TypeCode.String))
End Sub
DELETE Method
<DataObjectMethodAttribute(DataObjectMethodType.Delete, True)> _
Public Shared Sub Delete(ByVal TagID As Object)
Dim database As New CodeDataContext
Dim tag = (From t In database.Tags _
Where t.TagID = TagID _
Select t).Single
database.Tags.DeleteOnSubmit(tag)
End Sub
I also tried:
Where t.TagID = New Guid(TagID.ToString)
When I debug the TagID input in Delete method is recognized as Guid
but is empty.
What am I doing wrong?
Thank You,
Miguel