Solved

Accessing GridView Boundfields

Posted on 2009-05-04
5
309 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

Independent Software Vendors: 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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 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