mahmoud noraei wrote:
I intend use the [tokens] to allow users do design template.
The user using Notepad template design and the template to my module dynamically placed on repeater and gridview .
Ok - this is in the category of complex asp.net programming - and not something that relates directly to dnn itself.
I would suggest that you get hold of a good book on asp.net programming and develop a good understanding of the techniques that relate to asp.net control dynamic programming.
There is quite a lot of work to do to make this sort of thing work inside a repeater - and even more to attempt it in a grid view.
ONE OPTION WOULD BE TO LOOK AT CREATING THE TEMPLATE AT RUN TIME.
This link talks about the basics of dynamic construction of a template http://msdn.microsoft.com/en-us/library/0e39s2ck(v=vs.100).ASPX
As a basic starting point for what you want to do this would be a good place to start - it talks thru the methodologies for creating a template on the fly at run time.
To get an actual token system to work with this - you would need to extend the InstantiateIn()method to convert your user defined HTML layout into dynamic controls - which would not be that easy a task - the html layout would need to be entirely converted so that the bind elements work correctly at run time.
THE SECOND OPTION WOULD BE TO DO EVERYTING IN ITEM_DATABINDING
In this option - you would define the repeater template Declaratively - with just a single label control or placeholder control of some sort.
The actual injection of the HTML layout and replacement of tokens with data would then all be done manually in here.
So effectively something like a regex to get a list of all the tokens then a loop to process thru that list and replace each token with its underlying replacement value.
One of the advantages of doing this - would be that you could make available different sorts of custom tokens to just the fields in the database selection. Thinks like say a formatted token for dates - or a address block.
REGARDLESS - i would strongly again suggest getting hold of a good programming book on asp.net
Westa