开发者

Add support for fields to databound controls

For example when using a gridview. When you specify the columns

BoundField f开发者_开发百科or example won't work if you are binding it to a field instead of a property.

I guess this is so because when the gridview is looking for the DataField property it looks for a property and not a field. Now the question is how can i change this behavior to make it possible to use fields. I know i have to inherit from the gridview, but i don't know where to go from there.


This functionality is so wrapped into the framework and wasn't designed for extensibility so no you can't change this behavior; the only thing you can do is to create wrapper objects or wrap fields with properties.

Or render the UI in your own way, which then you lose the GridView in-built functionality.


Wrap the fields with Properties

    private string fieldA; 

    public string FieldA 
    {
      get { return fieldA; }
      set { fieldA = value; }
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜