Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUse TOKEN ??Use TOKEN ??
Previous
 
Next
New Post
3/3/2014 3:51 AM
 

Hi,

How do I create a token for use Repeater and GridView instead of <%# Eval("Topic") %> ?????

for example:
<div>
    <h3 ><%#Eval("Topic") %></h3>
    <hr />
    <asp:Panel ID="Panel3" runat="server" Visible='<%# bool.Parse(IndexImageCheck(Eval("IndexImages").ToString())) %>'>
        <img src='<%# Eval("IndexImages") %>' style="width: 100%; height: 200px;" />
    </asp:Panel>
    <div>
        <%#Eval("SingleText") %>
    </div>
</div>
<div>
    <h3>[TOPIC]</h3>
    <hr />
    <asp:Panel ID="Panel3" runat="server" Visible="[IndexImagesBool]">
        <img src="[IndexImages]" style="width: 100%; height: 200px;" />
    </asp:Panel>
    <div>
        [SingleText]
    </div>
</div>
 
New Post
3/3/2014 10:14 AM
 
Not sure what you are trying to achieve here - [tokens] are not something that exist as part of the asp.net system.
The asp repeater and gridview require the <%# Eval() %> constructs to allow their remapping of data to elements on the page.
 
New Post
3/3/2014 11:17 PM
 
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 .
 
New Post
3/4/2014 6:27 PM
 
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

 
New Post
3/4/2014 11:16 PM
 
Thank you very much
Now two questions:
How to use commands such as Eval() And Bind() prevent?
There is a list of the commands that you want to block them?
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUse TOKEN ??Use TOKEN ??


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out