S
Steve P
This really is a question for Datalist, since that is what I am primarily
using; however it should apply to Datagrid as well.
I would like to be able to assign the itemtemplate and edititemtemplate
programmatically based on how the user would like the data layed out. I have
been able to achieve this by using creating a class that implements the
ITemplate interface, however I soon realized the drawback in that custom
classes do not save their viewstate by default. Therefore I have to retrieve
the data and assign the templates at every postback, which consumes resources
and doesn't take advantage of the Viewstate properties of the
datalist/datagrid. I tried adding my custom template class to the viewstate,
but the error was that the object had to be serializable. I looked at this
briefly but gave up due to time constraints.
Having said all this, *ideally* what I would like is to be able to do is
just have the html templates in separate files and then instantiate a class
based on the user's preferred layout and assign it to the datalist. I think
this is possible somehow but I don't have the time to research it right now.
If anyone has done something like this before or would like to try, that
would be great!!
Thanks,
Steve
using; however it should apply to Datagrid as well.
I would like to be able to assign the itemtemplate and edititemtemplate
programmatically based on how the user would like the data layed out. I have
been able to achieve this by using creating a class that implements the
ITemplate interface, however I soon realized the drawback in that custom
classes do not save their viewstate by default. Therefore I have to retrieve
the data and assign the templates at every postback, which consumes resources
and doesn't take advantage of the Viewstate properties of the
datalist/datagrid. I tried adding my custom template class to the viewstate,
but the error was that the object had to be serializable. I looked at this
briefly but gave up due to time constraints.
Having said all this, *ideally* what I would like is to be able to do is
just have the html templates in separate files and then instantiate a class
based on the user's preferred layout and assign it to the datalist. I think
this is possible somehow but I don't have the time to research it right now.
If anyone has done something like this before or would like to try, that
would be great!!
Thanks,
Steve