What's a good way to set the Item or DataSource attribute of a FieldRenderer?

前端 未结 3 657
深忆病人
深忆病人 2021-02-10 14:52

The scenario is that I have a lot of FieldRenderers. These should output data from various places, some from item X and others from item Y. And should be outputting properties f

3条回答
  •  广开言路
    2021-02-10 15:21

    I understand you want to be able to do this on the front-end like in MVC-style and not in the code-behind, but that scenario seems to pose that a front-end FieldRenderer control may not be the right tool. I obviously saw the code you wrote in your answer but why not do this then, all on the front-end:

    <%= FieldRenderer.Render(item, "field name") %>
    

    E.g.

    <%= FieldRenderer.Render(ItemX, "Logo") %>
    

提交回复
热议问题