469,647 Members | 1,797 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,647 developers. It's quick & easy.

Problem with empty cell value in GridView

I have an cell which contains a field member which is filled with
String.Empty. When I retrieve the value in the cell with
Cells[0].Text.ToString() and try to compare it to String.Empty, I can't
because it contains "&nbsp". I really don't want to compare the value to
that so how can I retrieve an empty cell so that it is String.Empty.

Bill
Aug 6 '07 #1
3 3140
"Bill Gower" <bi*******@charter.netwrote in message
news:u0****************@TK2MSFTNGP05.phx.gbl...
Ok that's fine. I won't make it more difficult then it is. :) But now I
do have a real problem. I am retrieving the 3rd row which happens to have
no value in the cell and it is actually containing the value from the
first row same cell. When the gridview is displayed it is an empty cell
but when I retrieve it by

GridView.Rows[index].Cells[0].Text.ToString().

It has the value of the cell from the first row.

What is happening here?
Difficult to tell without seeing your code but, if you do a View Source on
the page in question, you will see the HTML table rendered from the GridView
webcontrol - does that shed any light on it...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 6 '07 #2
I checked the source and rows 1 to 3 have an entry in the cell and rows 4
to 5 have &nbsp in the cell. When I step through the code and check the
value at the cell from row 4, it has the value from the cell in row 1.

Bill
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:OU**************@TK2MSFTNGP02.phx.gbl...
"Bill Gower" <bi*******@charter.netwrote in message
news:u0****************@TK2MSFTNGP05.phx.gbl...
>Ok that's fine. I won't make it more difficult then it is. :) But now I
do have a real problem. I am retrieving the 3rd row which happens to
have no value in the cell and it is actually containing the value from
the first row same cell. When the gridview is displayed it is an empty
cell but when I retrieve it by

GridView.Rows[index].Cells[0].Text.ToString().

It has the value of the cell from the first row.

What is happening here?

Difficult to tell without seeing your code but, if you do a View Source on
the page in question, you will see the HTML table rendered from the
GridView webcontrol - does that shed any light on it...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 6 '07 #3
"Bill Gower" <bi*******@charter.netwrote in message
news:%2*****************@TK2MSFTNGP04.phx.gbl...
>I checked the source and rows 1 to 3 have an entry in the cell and rows 4
to 5 have &nbsp in the cell. When I step through the code and check the
value at the cell from row 4, it has the value from the cell in row 1.
Please show the code you're using...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mark Olbert | last post: by
4 posts views Thread by Ken Wigle | last post: by
14 posts views Thread by Mike | last post: by
3 posts views Thread by gnewsgroup | last post: by
2 posts views Thread by Bart | last post: by
nitindel
1 post views Thread by nitindel | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.