I've made a custom class for all my variables, to ensure that even though I should make a typo, it will not matter, since all places that variable is needed, it's fetched from the same string. Now I've just discovered, I have absolutely no idea how to use
it in an inline code.
App_Code/Settings.cs:
public class Settings
{
public static string ThumbnailFolder
{
get { return "Thumbnails"; }
}
}
usage in global.asax, no errors:
routes.Add(new Route(Settings.ThumbnailFolder + "/{folder}/{file}", new ThumbnailHandler());
Default.aspx, error:
<asp:Repeater ID="fileInfoRepeater" runat="server">
<ItemTemplate>
<img alt="<%#Eval("Name")%>" src="/<%Settings.ThumbnailFolder%>/<%#Eval("Name")%>" />
</ItemTemplate>
</asp:Repeater>
Can anyone tell me how to use it like that?
Best regards
Please remember to post your code.
If this post answered your question or solved your problem, please Mark it as Answer.
Trolderik
Member
645 Points
355 Posts
Repeater and custom class
Aug 10, 2012 09:55 PM|LINK
Hello,
I've made a custom class for all my variables, to ensure that even though I should make a typo, it will not matter, since all places that variable is needed, it's fetched from the same string. Now I've just discovered, I have absolutely no idea how to use it in an inline code.
App_Code/Settings.cs: public class Settings { public static string ThumbnailFolder { get { return "Thumbnails"; } } } usage in global.asax, no errors: routes.Add(new Route(Settings.ThumbnailFolder + "/{folder}/{file}", new ThumbnailHandler()); Default.aspx, error: <asp:Repeater ID="fileInfoRepeater" runat="server"> <ItemTemplate> <img alt="<%#Eval("Name")%>" src="/<%Settings.ThumbnailFolder%>/<%#Eval("Name")%>" /> </ItemTemplate> </asp:Repeater>Can anyone tell me how to use it like that?
Best regards
If this post answered your question or solved your problem, please Mark it as Answer.
Mastan Oli
Contributor
5088 Points
998 Posts
Re: Repeater and custom class
Aug 10, 2012 10:46 PM|LINK
Are you getting any error?
it should be <%= Settings.ThumbnailFolder%>/
playingOOPS | மெய்ப்பொருள் காண்பதறிவு
Mark as Answer If you find helpful
Trolderik
Member
645 Points
355 Posts
Re: Repeater and custom class
Aug 11, 2012 12:30 AM|LINK
Yes, I got some error, can't remember what it was, but I can remove the = sign and provoke it and post it if you want to know?
If this post answered your question or solved your problem, please Mark it as Answer.