Alexus
Alexus

Reputation: 952

How to access to parent class properties inside embedded code block?

I have a user control that inherits from another user control like so:

public partial class UserControlBase
{
    protected Vehicle _vehicle { get; private set; }
}

public partial class SpecificUserControl : UserControlBase
{
    // Vehicle is visible and accessible here... DUH.
}

However, when I try to databind vehicle properties inside inline code blocks, I get error: _vehicle doesn't exist in this context.

SpecificUserControl.ascx

<span><%# _vehicle.Brand %></span>

What am I doing wrong? Is it even possible?

Upvotes: 0

Views: 53

Answers (1)

Alexus
Alexus

Reputation: 952

The culprit was Visual Studio, 2013 in my case, glitch. Once restarted, everything worked smoothly.

Upvotes: 1

Related Questions