Solved

Accessing GridView Boundfields

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 …
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

20 Experts available now in Live!

Get 1:1 Help Now