mjacobson
May 20th, 2005, 02:59 PM
I am working on a web application in C# and have set up a repeater to display a list of items. One of the fields being returned from the SQL database is a list of terms seperated by a space. I need to be able to split each of these terms so I can make a link to another pages on the site.
I have been trying to do this in the "ItemTemplate" declaration with the following code segment
//string taglist = "test test2 test3 test4";
string taglist = DataBinder.GetPropertyValue(Container.DataItem, "tag_list");
foreach(string tag in taglist.Split(' '))
{
Response.Write(tag + "<BR>");
}
This produces the following error,
The type or namespace name 'Container' could not be found (are you missing a using directive or an assembly reference?)
When I use <%#DataBinder.Eval(Container.DataItem, "tag_list")%> I get the string printed out to the web page with no errors. Is there a way to set this equal to a temp string variable so I can split it and produce the output that I need?
Thanks for your help. I am looking forward to the answer.
I have been trying to do this in the "ItemTemplate" declaration with the following code segment
//string taglist = "test test2 test3 test4";
string taglist = DataBinder.GetPropertyValue(Container.DataItem, "tag_list");
foreach(string tag in taglist.Split(' '))
{
Response.Write(tag + "<BR>");
}
This produces the following error,
The type or namespace name 'Container' could not be found (are you missing a using directive or an assembly reference?)
When I use <%#DataBinder.Eval(Container.DataItem, "tag_list")%> I get the string printed out to the web page with no errors. Is there a way to set this equal to a temp string variable so I can split it and produce the output that I need?
Thanks for your help. I am looking forward to the answer.