Solved populate extra column in GridView through button click

Posted on 2011-10-22
Last Modified: 2012-05-12

I have a GridView on my site that has an extra column containing buttons
and another containing labels. When I click the button in one row I have managed to populate the label column with text. The only problem is that when I click the next row it clears the label populated in the other one. I need to stop this from happening
Private Sub GridView2_RowCommand1(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView2.RowCommand
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                ' Retrieve the row that contains the button 
                ' from the Rows collection.
                Dim row As GridViewRow = GridView2.Rows(index)
                row.Cells(0).Text = "Strongly Agree"

Open in new window

Question by:murbro
    LVL 96

    Accepted Solution

    If you are doing something dynamically, that is not stored in the view state, then you need to recreate that when you post back the page.

    Author Closing Comment

    Thanks very much

    Featured Post

    Threat Intelligence Starter Resources

    Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

    Join & Write a Comment

    I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    This video discusses moving either the default database or any database to a new volume.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now