Solved

Accessing GridView Boundfields

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

ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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