Solved

Accessing GridView Boundfields

Posted on 2009-05-04
5
308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

740 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