Saif Khan
Saif Khan

Reputation: 18772

Object Instance in C#

Why do I get "Object Reference Not Set to Instance of an Object"

protected void GetData()
{
    ...

    id = this.GetTabControl().ID; //<---------here
}

...

protected ASPxPageControl GetTabControl()
{
    return (ASPxPageControl)this.FindControl("DetailTab");
}

---------I assume the FindControl is not working.

Upvotes: 0

Views: 381

Answers (2)

Raul Agrait
Raul Agrait

Reputation: 6018

GetTabControl() must be returning a null reference.

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1499770

Presumably because GetTabControl() is returning null. We can't tell why without more code though.

Upvotes: 3

Related Questions