Solved

Reading gridview value

Posted on 2009-05-07
4
248 Views
Last Modified: 2013-11-08
I want to read a column value in MS gridview control using FOR loop. I will basically comparing the value in each row for that column and then I will have to put that row in edit mode if the values of that row match with what I have in a variable.

How would I do that? Please help
0
Comment
Question by:vrao92
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Deathrace
ID: 24327869

Got the solution, see below

Cells[2] .. where 2 is the column index which we need.

for (int i = 0; i < GridViewHW.Rows.Count; i++)
        {
            string value = GridViewHW.Rows[i].Cells[2].ToString();
        }
0
 

Author Comment

by:vrao92
ID: 24327998
I converted this code to Vb.net and this is what I have
  Dim sValue As String
        For i As Integer = 0 To GridView3.Rows.Count - 1
            sValue = GridView3.Rows(i).Cells(4).ToString()
        Next

And in my imeediate window I typed in ?svalue and I get this.. System.Web.UI.WebControls.DataControlFieldCell
but not the value
0
 
LVL 6

Accepted Solution

by:
M3mph15 earned 500 total points
ID: 24333609
Hi, Try sValue = GridView3.Rows(i).Cells(4).Text.ToString()
0
 

Author Comment

by:vrao92
ID: 24335380
Thank you..I tried and it worked.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Learn how to set-up PayPal payment integration in your Wufoo form. Allow your users to remit payment through PayPal upon completion of your online form. This is helpful for collecting membership payments, customer payments, donations, and more.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now