Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > how to get a combination name using Eval() View modes: 
User avatar
Member
Member
steven4733-gmail - 1/25/2012 10:42:10 AM
   
how to get a combination name using Eval()
I'm wondering how to get a combination name like "test1" by using <%# Eval("id") %>

I want to name a div by the id field from a datatable, I can get the id in frontend by using <%# Eval("id") %>, I want the div name to be something like test1, test2...

Is this right?
<div id="<%# test+Eval("id") %>"></div>

This code is supposed to write in frontend page of an asp.net website project.

User avatar
Member
Member
steven4733-gmail - 1/25/2012 2:07:57 PM
   
RE:how to get a combination name using Eval()
I got it, by using
<div id="test<%# Eval("id") %>"></div>

Never mind.

User avatar
Kentico Support
Kentico Support
kentico_janh - 1/26/2012 1:47:52 AM
   
RE:how to get a combination name using Eval()
Hello,

That is it! And there is another notation for that:

<div id='<%# "test" + Eval("id") %>'></div>


But the result is always the same :)

Best regards,
Jan Hermann

User avatar
Certified Developer 8
Certified Developer 8
Jiveabillion - 1/27/2012 3:36:03 PM
   
RE:how to get a combination name using Eval()
The easiest way to determine if you are writing these code blocks right is to remember that anything inside the <%# %> tags needs to be valid C# code as if you were writing it in code behind.