Solved

Accessing GridView Boundfields

Posted on 2009-05-04
5
304 Views
Last Modified: 2012-05-06
I have a gridview with a number of BoundFields in it.

In the C# Codebehind i'm trying to evaluate one of the columns like the attached but it's not getting anything even though the GridView is populated.
protected void OrdersGridView_RowDataBound(object sender, GridViewRowEventArgs e)

    {

if (e.Row.RowType == DataControlRowType.DataRow)

        {

            string TheOrderID = e.Row.Cells[0].Text.ToString();

            Response.Write(TheOrderID);

        }

     }

Open in new window

0
Comment
Question by:andrewmilner
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:chuckdsc
ID: 24296891
andrewmilner

is the boundfiled you are trying to access visible?
0
 

Author Comment

by:andrewmilner
ID: 24298152
Yes it is.
0
 
LVL 1

Expert Comment

by:chuckdsc
ID: 24298913
andrewmilner:

can you check if the gridview control has the following property setup correctly, pointing it to the correct event handler

onselectedindexchanged="GridView1_SelectedIndexChanged"

Chuck
0
 
LVL 1

Accepted Solution

by:
chuckdsc earned 500 total points
ID: 24298922
check this , mis-typed the earlier post

onrowdatabound="GridView1_RowDataBound"
0
 

Author Comment

by:andrewmilner
ID: 24299755
That was it.  Thank you!
I was using OnRowSelecting.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

22 Experts available now in Live!

Get 1:1 Help Now