Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Gridview is not refreshing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shapper - 20 Sep 2007 17:29 GMT
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
shapper - 20 Sep 2007 22:27 GMT
> Hello,
>
[quoted text clipped - 48 lines]
>
> Miguel

Please, anyone?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.