Hello,
I have several group fields which are numbered, so to avoid writing 20 times the same html code, I wanted to do a for loop :
@for (int i = 1; i <= 10; i++)
{
tagName = "Ecom:Group:Field.Picture" + i.ToString() + ".Value.Clean";
if (!string.IsNullOrWhiteSpace(GetString(tagName)))
{
<img src="@GetString(tagName)" />
}
}
However this doesn't work. GetString gives me an empty string. If I put the tag name textually (i.e "Ecom:Group:Field.Picture1.Value.Clean", etc.) it works.
I tried to isolate the problem. This doesn't work either :
string one = "1";
string tag = "Ecom:Group:Field.Picture" + one + ".Value.Clean";
@designer.GetValue(tag)
Neither does this :
string tag = "Ecom:Group:Field.Picture" + "1.Value.Clean";
@designer.GetValue(tag)
However, this is ok :
string tag = "Ecom:Group:Field.Picture1.Value.Clean";
@designer.GetValue(tag)
This is a pretty weird behaviour...
Any idea ?
Thanks !