473,473 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 3296
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Mark Olbert | last post by:
I ran into a situation this morning where the RowUpdating event of a GridView kept insisting there were no entries in either the OldValues or NewValues dictionaries. The GridView is bound to a...
4
by: Ken Wigle | last post by:
All, I would be very grateful for any help on this question. I have an application in asp.net 2.0 where I dynamically create a datatable and then bind that to a gridview. Unfortunately, the...
1
by: Martin | last post by:
Hi, I'm having a problem with a datagridview control when trying to read the value of an unbound checkbox cell. The code below works fine if I click on any text cell, bound or unbound, and...
1
by: K B | last post by:
I would like to create a gridview as below: Project Name 1-1 1-2 1-3 1-4 1-5 1-6 Project 1 BLUE BLUE BLUE BLUE GREEN GREEN more projects I would like to fill the...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
3
by: gnewsgroup | last post by:
I have a GridView which is bound to my database. The leftmost column of the GridView has a value of either 0 or 1, and I need to highlight the cell of column 3 if the leftmost column has a...
2
by: Bart | last post by:
Hi, i need to check wether a cell of a gridview is empty or not. I did this: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles...
1
Frinavale
by: Frinavale | last post by:
I'm working on an ASP.NET application using VB.NET for server side code. I have a GridView listing a bunch of stuff. Above the GridView I have a checkbox named "ChkBx_SelectAll". If this...
1
nitindel
by: nitindel | last post by:
Hi All, Please tell me any good site for Gridview control.(not for datagrid). I am facing error in fetching the values of the Bound columns in the gridview: lease tell me how should i...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.