Bind list from FormView to model in ASP.net webforms

Posted by Monty on Stack Overflow See other posts from Stack Overflow or by Monty
Published on 2010-03-05T08:02:55Z Indexed on 2010/03/08 14:51 UTC
Read the original article Hit count: 529

Filed under:
|
|
|

For a large fillin form I use the asp.net FormView for the magic databinding to my model. In this model I've a property called Rides (shown below), which exposes a list, which I obviously not want to be replaced entirely. So I made it readonly.

However, this way I can't use the databinding features anymore. Is there a common solution for this problem?

public IList<Ride> Rides
{
    get
    {
        if (this._rides == null)
        {
            this._rides = new List<Ride>();
        }

        return this._rides;
    }
}

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about formview