Click here to Skip to main content
15,867,939 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to assign the value in Cell5 of GV row to a variable 'dd'.
I used the following code but get error like: Error 4 Non-invocable member 'System.Web.UI.WebControls.GridView.Rows' cannot be used like a method.

C#
int ii;
for (ii = 0; ii <= GridView3.Rows.Count; ii++)
{
    string dd = GridView3.Rows(ii).Cells[5].Text;
}
Posted

1 solution

string dd = GridView3.Rows[ii].Cells[5].Text;
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Dec-13 1:09am    
This "answer" is a total abuse. This is like asking "how much is 2 + 2" and, after 14 minutes, posting an "answer" to yourself: "4!".
—SA
Sergey Alexandrovich Kryukov 15-Dec-13 3:16am    
Not quite common. Common only in certain kind of members. Anyway, don't you see something wrong in it? :-)
A number of members have been blamed in massive abuse of this sort and lost their membership; but and I don't think this should be the case with OP...
—SA
Thanks7872 15-Dec-13 4:27am    
I would have elaborated more. I meant that it is common practice by OP till now.Currently there is only 3 answers but if it grows, there will be need for some treatment too :-)

Please see my comment to OP below.
Sergey Alexandrovich Kryukov 15-Dec-13 13:00pm    
I have a short list of some of such violators. When I started to report some at abuse forum, it did not find enough understanding in members. Maybe some some deserve cancellation of account (which actually happened in rare cases), but some would need some warning. Some maintain that some such answers are useful for community.

My argument was: the site should totally block self-answers. It would solve all problems: nobody gets reports or down-votes for that. Got really interesting solution to own problem? Write a tip or (in really rare cases) an article. Not interesting enough? No time for that? Mention that the problem is self-solved in the edited body of the question.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900