e.Row.Cells().Text
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17231
Printed Date: 29 March 2026 at 12:41pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: e.Row.Cells().Text
Posted By: davidshq
Subject: e.Row.Cells().Text
Date Posted: 12 November 2005 at 12:58am
Okay, I have really narrowed my problem down. When I just pass the
stored procedure through, it generates in the GridView fine. But when I
attempt to perform manipulation on the GridView by using e (which is
GridViewRowEventArgs) I get an error. For some reason ASP.NET 2.0
thinks the GridView doesn't contain these cells or values or something
akin to that. Basically what I am doing is:
e.Row.Cells(1).Text = "Hello World!"
But it thinks the cells don't exist.
David.
------------- - http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.
|
Replies:
Posted By: davidshq
Date Posted: 12 November 2005 at 1:32am
I discovered that for some reason e.Row.Cells(6) is not being viewed as
a DataControl of RowType DataRow (DataControlRowType.DataRow). Any
ideas why this might be?
David.
------------- - http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.
|
Posted By: davidshq
Date Posted: 14 November 2005 at 8:06pm
I fixed it. Basically there were two problems:
(1) I wasn't making sure that the row I was handling was a DataRow. I fixed this by adding:
If e.Row.RowType = DataControlRowType.DataRow Then
(code modifying GridView columns)
End If
(2) While troubleshooting I had changed e.Row.Cells(6).Text to
e.Row.Cells(6).ToString, which was passing the entire cell rather than
just the text, so I changed it back to .Text.
David.
------------- - http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.
|
|