Can I add a text value to a gridview cell "manually" vs via dataset?

I've got a working ASP app with a gridview populated via a SQL select string.
I'd like to add a column at the end of the gridview, and populate it in a For loop, where I'm doing some other checks when the gridview refreshes..

Something like:
                    GridView1.Rows(i).Cells("MYNEWCOLUMNNAME").Text = "hi"

Open in new window

I tried adding a new column in the gui "SITE", as a BoundField, but I'm thinking this isn't going to work quite that easily..

Richard GouetteIT ManagerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dirk StraussSenior Full Stack DeveloperCommented:
If you have an ASP.NET app, you would need to add your column to the grid and then perform your logic in the ItemDataBound event of the grid to do the required checks and insert the value into the column you added.

I'm not sure if this is what you need. Do you want to add the extra column after the initial grid bind? The ItemDataBound event fires as each row in your grid is populated.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard GouetteIT ManagerAuthor Commented:
the 'manual' data would be bound after the initial gridview data is bound.
In my page load, I have  a for loop that's doing some manipulation of cells, and I was hoping I could insert
values into my new column within that loop..
Not sure if that makes sense
I noobishly thought that I could insert logic such as:
GridView1.Rows(i).Cells("CELLNAME").Text = "hi"

Open in new window

Richard GouetteIT ManagerAuthor Commented:
I adding this under the page load event:
        Dim ColumnName As New BoundColumn()
        ColumnName.DataField = "SITE"
        ColumnName.HeaderText = "SITE"

Open in new window

It adds a new column, but I cannot manage to poke any values into any new cells..?
I do not see 'ItemDataBound' as an event of my gridview: maybe I'm looking in the wrong place..?
Richard GouetteIT ManagerAuthor Commented:
going to repost and hopefully,. make more sense of what I've got , and am doing
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.