Link to home
Start Free TrialLog in
Avatar of Butler Bros
Butler BrosFlag for United States of America

asked on

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..

Thoughts?
ASKER CERTIFIED SOLUTION
Avatar of Dirk Strauss
Dirk Strauss
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Butler Bros

ASKER

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

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..?
going to repost and hopefully,. make more sense of what I've got , and am doing