Object Reference Not Set / GridView TemplateItem

Discussion in 'ASP .Net Datagrid Control' started by Ross Culver, May 9, 2007.

  1. Ross Culver

    Ross Culver Guest

    Here's a curious one . . .

    In one column of my gridview, I have two templateitems, one above the other
    (namely company name and street address, respectively). Works fine.

    On gv.SelectedIndexChange I capture the street address into a session
    variable for further processing thusly (addr =
    me.gv.SelectedRow.Cells(2).Text) and when the result set is more than 10 (my
    PageSize) everything's fine. But whenever the result set is less than 10
    resulting in only one page, I get the ole' "object reference not set ....."
    message on gvSelectIndexChange.

    I thought it might be occurring whenever the company name field was blank,
    but that's not the problem. I would specify the exact templateitem since
    there are actually two templateitems in the same cell, but I don't know how
    to do that using code behind.

    Any suggestions?

    Thanks,

    Ross
    Ross Culver, May 9, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Parthiv Joshi
    Replies:
    2
    Views:
    680
    Kalyan
    Jul 2, 2004
  2. Suresh Kojhani
    Replies:
    1
    Views:
    2,376
    Anushi
    Jul 29, 2004
  3. Replies:
    0
    Views:
    472
  4. Replies:
    1
    Views:
    476
    Mark Rae [MVP]
    Sep 20, 2007
  5. Replies:
    1
    Views:
    3,732
    Muhammad Naveed Yaseen
    Mar 3, 2008
Loading...

Share This Page