views:

87

answers:

1

I have this:

<img id="imgField" alt="" runat="server" src='<%# string.Format("images/{0}.jpg", DataBinder.Eval(Container.DataItem,"Name")) %>' />

and it's rendering %20's from the spaces in the databound Name. So I need to replace all of the "%20's" with ""

I tried

<img id="imgField" alt="" runat="server" src='<%# string.Format("images/{0}.jpg", DataBinder.Eval(Container.DataItem,"Name")).Replace("%20","") %>' />

and that didn't work... Anyone know?

Thanks,
Matt

+1  A: 

The %20 values are probably a result of the control parsing the attribute. If you want to eliminate spaces try .Replace(" ", "")

Spencer Ruport
Didn't think it would replace it like that, when I looked at the source it would always say %20, but that makes sense now that I think about it. Thanks!
Matt