Connecting Tech Pros Worldwide Forums | Help | Site Map

Asp.net User Control or Custom control Property doesnt accept inline asp.net constrac

Newbie
 
Join Date: Aug 2008
Posts: 1
#1: Aug 25 '08
Hi , I have got problem with passing my inline based value to y user
control (or custom control, no matter which one I use, I have tried
both to make sure it doesnt matter) .
So say I have property called ImagePath and i want to pass my value
through asp.net specific inline cunstruction:
<uc:MyControl runat=server id="someId" ImagePath="<%=
Request.ApplicationPath %>/App_Themes/<%= Page.Theme %>/Images/
ball_.png" />,

problem that in my property I get value exactly word for word:<%=
Request.ApplicationPath %>/App_Themes/<%= Page.Theme %>/Images/
ball_.png , but i Should get it like:
/WebSiteRoot/App_Themes/Green/Images/ball_.png.


For example if I use simple img html tag i works:
<img src="<%= Request.ApplicationPath %>/App_Themes/<%= Page.Theme %>/
Images/ball_.png" />
But if i add runat=server it brokes and i dont see any image coz the
path of image already messy string with <%= and so on.


I tried a lot of attributes to my ImagePath that found in web posts to
let it work (i.e.: [Bindable(true)],[Category("Data")],
[Browsable(true)] and many more) but no result.


Please let me know if you can resolve this interesting trick somehow?

jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Aug 25 '08

re: Asp.net User Control or Custom control Property doesnt accept inline asp.net constrac


I think you might be mixing ASP and ASP.NET. The two are incompatible. runat designates ASP.NET. <%=%> is a standard ASP response.write shorthand. Some ASP syntax works in .NET, but not all, and it is easier to use strictly one or the other from a troubleshooting standpoint. What is your IDE? Are you just coding in notepad?

Jared
Reply