Clinton,
I see your point, yet I my brain still find it difficult to debug in
some case. (e.g.: one of my site keep getting viewstate related exceptions
on clients running IE5 in MacPPC, and still can't figure out why.) :)
Back to the question, I think you may try to add Id to the webcontrol as
it's anyway essential for further control of the object in server-side. And
I suggest you check the Request.Cookies["themeName"].Value and
Request.Cookies["themePrefix"].Value is initialized when the page is
rendering. I have no idea how .NET will deal with it if .NET see it's a
"nothing" value.
Regards,
Lau Lei Cheong
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> ¼¶¼g©ó¶l¥ó·s»D:uj**************@TK2MSFTNGP15.phx.g bl...
Thanks for responding. I knew I could change the src attributes in code
but I'm still not ready to give up on what is supposed to be the new
declarative model. For example, I just looked up the new expression syntax
[1].
That may allow me to use <%$ expression %> for the purpose I am
interested in but I don't understand how it can be used yet because I am
still getting server control not well formed errors...
<%= Clinton Gallagher
[1]
http://beta.asp.net/QUICKSTARTV20/as...px#expressions
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:ez**************@TK2MSFTNGP14.phx.gbl... Hello,
Try give your image control an Id then use it to change the src in the
code.
Now suppose you want to change an image:
In HTML:
<img id="img_1"
src="App_Themes/SmokeAndGlass/Images/smoke_METRO184x26.gif"
runat="server"/>
At codebehind:
img_1.Src = "App_Themes/" & Request.Cookies["themeName"].Value &
"/Images/" & _
Request.Cookies["themePrefix"].Value & "METRO184x26.gif"
Since .NET framework is Object-Oriented in nature, for good coding
style use <%= %> as few as possible.
Regards,
Lau Lei Cheong
"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> ¼¶¼g©ó¶l¥ó·s»D:e$**************@TK2MSFTNGP14.phx.g bl... Simply a postulation but consider the following...
// breaks when declared in content page that uses a MasterPage
<img src="App_Themes/SmokeAndGlass/Images/smoke_METRO184x26.gif" />
// must run as a web server control
<img src="App_Themes/SmokeAndGlass/Images/smoke_METRO184x26.gif"
runat="server" />
However... When we want to change themes dynamically how do we modify
the value of the path for the src attribute at runtime? In ASP we used
Response.Write code blocks <%= %> the .NET equivalent of which are not
allowed in web server control declarations hence the postulation as we
are apparently missing the functional construct.
What I thought I need is the following in my HTML...
<img src="App_Themes/<%= Request.Cookies["themeName"].Value;
%>/Images/<%= Request.Cookies["themePrefix"].Value; %>METRO184x26.gif"
/>
runat="server" />
I've tried different quoting types but I'm not getting it right.
I've tried a binding syntax <%# %> and am not getting it right.
Surely this is me as I can't imagine the design of 2.0 is this seriously
flawed that the entire img element would have to be built in code when
using MasterPages that require dynamic Theme selections.
<%= Clinton Gallagher