please see the example at http://www.devexpress.com/Support/Center/Example/Details/E1433. It explains how to assign the ItemTemplate at runtime.
I'm trying to do this but the difference is that my AspxDataView is also created at runtime. So I have:
ASPxDataView dv = new ASPxDataView();
dv.ItemTemplate = new MyItemTemplate();
dv.DataSource = sQueries.DameQuejasSector(sesion, 1); // my query...
When DataBind() is executed container is almost null and container.TemplateControl is null so I get an error.
I see that just after dv is created its TemplateControl is null, but if I use an existing AspxDataView its properties are filled. How can I create a dataview at runtime and initialize it so then I can assign its ItemTemplate?
Thank you in advance.
I see that you forgot to add ASPxDataView into a form. Please modify your code, as shown below:
ASPxDataView dv = new ASPxDataView(); form1.Controls.Add(dv); dv.ItemTemplate = new MyItemTemplate(); dv.DataSource = sQueries.DameQuejasSector(sesion, 1); // my query... dv.DataBind();
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.