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?


    Ross Culver, May 9, 2007
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.