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

前端 未结 3 2111
孤城傲影
孤城傲影 2021-02-10 14:50

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:27

    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") %>
    

提交回复
热议问题