Dynamically change GridView item template
I have a fairly big asp.net website that use GridView bound to the same object in lots of places. I’m using an item template to customize each row. However to have the same template in all the pages I have to copy & paste the item template to each page. Obviously this is not the best solution. On top of this I want to be able to change the template used by the GridView, by changing some configuration file.
One option would be to create an user control with the DataGrid and expose the necessary properties to be used in each page. However this does not fulfill the second requirement to be able do dynamically change the template.
Basically I’m looking for a way to say to the GridView to use a template and be able to do this dynamically. Any idea would be helpful.