S
shapper
Hello,
I have a GridView which is being created at runtime. When I delete a
row the grid is only updated after i make refresh on my browser? Why?
I have the gvPosts.Databind() on my RowDeleting event.
Maybe the order and placement of my gridview properties and bind is
wrong through my gridview events.
Could someone, please, check this out? Here are the 3 events I am
using:
Protected Sub gvPosts_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles gvPosts.Init
gvPosts.AutoGenerateColumns = False
gvPosts.ID = "gvPosts"
Dim tfPost As New TemplateField
tfPost.ItemTemplate = New tfPost(ListItemType.Item)
gvPosts.Columns.Add(tfPost)
End Sub ' gvPosts_Init
Private Sub gvPosts_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles gvPosts.Load
Dim mc As New MyClass
With gvPosts
.DataSource = mc.GetData
.DataKeyNames = New String() {"Id"}
.DataBind()
End With
End Sub ' gvPosts_Load
Protected Sub gvPosts_RowDeleting(ByVal sender As Object, ByVal e
As GridViewDeleteEventArgs) Handles gvPosts.RowDeleting
Dim mc As New MyClass
mc.Delete(New
Guid(gvPosts.DataKeys(e.RowIndex).Value.ToString()))
gvPosts.DataBind()
End Sub ' gvPosts_RowDeleting
Any idea what I am doing wrong?
Thanks,
Miguel
I have a GridView which is being created at runtime. When I delete a
row the grid is only updated after i make refresh on my browser? Why?
I have the gvPosts.Databind() on my RowDeleting event.
Maybe the order and placement of my gridview properties and bind is
wrong through my gridview events.
Could someone, please, check this out? Here are the 3 events I am
using:
Protected Sub gvPosts_Init(ByVal sender As Object, ByVal e As
EventArgs) Handles gvPosts.Init
gvPosts.AutoGenerateColumns = False
gvPosts.ID = "gvPosts"
Dim tfPost As New TemplateField
tfPost.ItemTemplate = New tfPost(ListItemType.Item)
gvPosts.Columns.Add(tfPost)
End Sub ' gvPosts_Init
Private Sub gvPosts_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles gvPosts.Load
Dim mc As New MyClass
With gvPosts
.DataSource = mc.GetData
.DataKeyNames = New String() {"Id"}
.DataBind()
End With
End Sub ' gvPosts_Load
Protected Sub gvPosts_RowDeleting(ByVal sender As Object, ByVal e
As GridViewDeleteEventArgs) Handles gvPosts.RowDeleting
Dim mc As New MyClass
mc.Delete(New
Guid(gvPosts.DataKeys(e.RowIndex).Value.ToString()))
gvPosts.DataBind()
End Sub ' gvPosts_RowDeleting
Any idea what I am doing wrong?
Thanks,
Miguel