Advertisement

05.29.2008 at 02:49PM PDT, ID: 23443094
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Refresh Gridview after a delete - Gridview databound to a datatable populated from a data tier

Asked by NorthReno in Microsoft Visual Basic.Net, DB2 Database, Programming for ASP.NET

Tags: ,

I am using a Gridview that is a hodgepodge of databound controls including textboxes, labels and dropdown lists.  Each row in the gridview is conglomerate of a record from a primary table and its subordinate details.

All data operations (select, insert, update and delete) are handled by a data tier consisting of middleware and COBOL... database is DB2.  A preformatted request is sent out and a datatable is returned.

The datatable is then bound to the datagrid assigning it to the datasource.

With that preface in mind, the program presents the user with the friendly gridview and they click on the select button on the item in the gridview they wish to delete.  They click the (separate from gridview) delete button.  The button event issues another request through the aforementioned data tier.  There is nothing returned as it was decided that would be to much overhead.

I just want to refresh the gridview (no problem initiating a refresh) and have the deleted item to no longer display.  I tried using the following logic to remove the item from the module level datatable (retruned from the initial select), and then delete row from the gridview:
            With Gridview1
                psReplyData.Rows(.SelectedIndex).Delete()
                .DeleteRow(.SelectedIndex)
            End With

This is performed in the in the delete button_click event.  By the time it reaches this code the psReplyData datatable object is set back to nothing.  It is still bound to the Gridview1, but is only mnemonic and no longer part of an object I can access.  I believe that the statelessness of the objects is the major problem.  When the gridview refreshes itself and runs its Load event, everything is set to nothing and the Gridview still has its original set of data in memory only.

Just performing the DeleteRow on the Gridview doesn't accomplish this task because of what was discussed in the last paragraph.

I may be stuck with adding the piggy overhead of making it recreate the datatable with the latest data.

Any input would be greatly appreciated.  Also, I am a VB programmer.  I can read C# but if code is shared, vb would be preferred.  Thanks in advance.Start Free Trial
[+][-]05.29.2008 at 02:56PM PDT, ID: 21673659

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Microsoft Visual Basic.Net, DB2 Database, Programming for ASP.NET
Tags: ASP.NET version 2.0 and Visual Basic 2005, Internet Explorer
Sign Up Now!
Solution Provided By: skiltz
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.29.2008 at 05:01PM PDT, ID: 21674320

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 05:13PM PDT, ID: 21674372

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.29.2008 at 05:49PM PDT, ID: 21674490

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628