I use a repeater on my website.
My code for this example is
Now, depending on the result of the dataitem will depend on what I want to display. For example, The databitem may show a true or false value, and depending on which one I want to show a different result on my page. So instead of it display true, it display a string. EG, if true, the text 'in stock' would display.
At the moment, I am using a method to call a function (please correct my terminology - or let me know my terminology is right!).
html:
code behind:
Is this the best way as it appears to be an ugly fix in my opinion. Especially as I have several items on my page which will have to use this (ususally just checking if there is a value in the dataitem or if it is empty/null)
Thanks
Dave
My code for this example is
Code:
<ItemTemplate> Item: <%#DataBinder.Eval(Container.DataItem, "Col")%><br> </ItemTemplate>
At the moment, I am using a method to call a function (please correct my terminology - or let me know my terminology is right!).
html:
Code:
<ItemTemplate> Item: <%#CB(DataBinder.Eval(Container.DataItem, "Col"))%><br> </ItemTemplate>
Code:
public string CB(object o)
{
//perform something
return string.format("");
}
Thanks
Dave
Comment