PC Review


Reply
Thread Tools Rate Thread

<%= _s_Variable %> not working

 
 
Jennifer Mathews
Guest
Posts: n/a
 
      16th Nov 2009
I have all my images in a directory called "images/Red". They are all the same color and
look the same way. They are all called like the following code:


<asp:ImageButton ID="cmdSave" runat="server" ImageUrl="~/images/Red/Save.jpg"
AlternateText="Save" />


Now some users are complaining they can't see them clearly but some users want them to
stay that color (Red). No problem I thought. I created Blue buttons and put them in
another directory called "images/Blue".


I have _s_CSS_Btn_DWhr as a friend variable "Red". (The default.) I thought the
following would work in the ascx but it doesn't.


<asp:ImageButton ID="cmdSave" runat="server" ImageUrl="~/images/<%= _s_CSS_Btn_DWhr
%>/Save.jpg" AlternateText="Save" />

Instead of substitues "Red" for <%= _s_CSS_Btn_DWhr %> the processor writes
%3C%25=%20_s_CSS_Btn_DWhr%20%25%3E


Can someone tell me what I am doing wrong?

Thanks

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      17th Nov 2009
On Nov 16, 9:43*pm, "Jennifer Mathews" <waltersjenni...@live.com>
wrote:
> I have all my images in a directory called "images/Red". They are all thesame color and
> look the same way. *They are all called like the following code:
>
> <asp:ImageButton ID="cmdSave" runat="server" ImageUrl="~/images/Red/Save.jpg"
> AlternateText="Save" />
>
> Now some users are complaining they can't see them clearly but some userswant them to
> stay that color (Red). *No problem I thought. *I created Blue buttonsand put them in
> another directory called "images/Blue".
>
> I have _s_CSS_Btn_DWhr as a friend variable "Red". (The default.) *I thought the
> following would work in the ascx but it doesn't.
>
> <asp:ImageButton ID="cmdSave" runat="server" ImageUrl="~/images/<%= _s_CSS_Btn_DWhr
> %>/Save.jpg" AlternateText="Save" />
>
> Instead of substitues "Red" for <%= _s_CSS_Btn_DWhr %> the processor writes
> %3C%25=%20_s_CSS_Btn_DWhr%20%25%3E
>
> Can someone tell me what I am doing wrong?
>
> Thanks


Try

<asp:ImageButton ID="cmdSave" runat="server" ImageUrl="<%= "~/images/"
& _s_CSS_Btn_DWhr & "/Save.jpg" %>" AlternateText="Save" />

if it's on c# then use + instead of &
 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      17th Nov 2009
Jennifer Mathews wrote:
> Can someone tell me what I am doing wrong?


Using <% %> inside a control won't necessarily work. Instead, you can set
cmdSave.ImageUrl in the Page_Load handler.

Andrew


 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      17th Nov 2009
On Nov 17, 1:31*pm, "Andrew Morton" <a...@in-press.co.uk.invalid>
wrote:
> Jennifer Mathews wrote:
> > Can someone tell me what I am doing wrong?

>
> Using <% %> inside a control won't necessarily work. Instead, you can set
> cmdSave.ImageUrl in the Page_Load handler.
>
> Andrew


Andrew, you're right, please ignore my post...

Jennifer, either assign url in the code behind, or add in top of your
page

<script language="VB" runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs)
cmdSave.ImageUrl = "~/images/" & _s_CSS_Btn_DWhr & "/
Save.jpg"
End Sub
</script>

and then it should work.
 
Reply With Quote
 
Jennifer Mathews
Guest
Posts: n/a
 
      17th Nov 2009
Wow. I have to change probably a couple of hundred of these and doing this in the code
behind really is terrible. I was really hoping I could do this with a search & replace
for all the ascx pages. Of well. Thanks for the replies.


"Andrew Morton" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Jennifer Mathews wrote:
>> Can someone tell me what I am doing wrong?

>
> Using <% %> inside a control won't necessarily work. Instead, you can set
> cmdSave.ImageUrl in the Page_Load handler.
>
> Andrew
>


 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      17th Nov 2009
On Nov 17, 3:03*pm, "Jennifer Mathews" <waltersjenni...@live.com>
wrote:
> Wow. *I have to change probably a couple of hundred of these and doing this in the code
> behind really is terrible. *I was really hoping I could do this with a search & replace
> for all the ascx pages. *Of well. *Thanks for the replies.
>
> "Andrew Morton" <a...@in-press.co.uk.invalid> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Jennifer Mathews wrote:
> >> Can someone tell me what I am doing wrong?

>
> > Using <% %> inside a control won't necessarily work. Instead, you can set
> > cmdSave.ImageUrl in the Page_Load handler.

>
> > Andrew- Hide quoted text -

>
> - Show quoted text -


Another option could be converting ASP.NET control into HTML input
control

<input type="image" src='<%"/images/" & _s_CSS_Btn_DWhr & "/Save.jpg"
%>' />

which could act the same as ImageButton
 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      17th Nov 2009
Jennifer Mathews wrote:
> Wow. I have to change probably a couple of hundred of these and
> doing this in the code behind really is terrible. I was really
> hoping I could do this with a search & replace for all the ascx
> pages. Of well. Thanks for the replies.


You could write a program to do it...

Andrew


 
Reply With Quote
 
Jennifer Mathews
Guest
Posts: n/a
 
      18th Nov 2009
Actually, I just had to use the hyperlink HTML control (non ASP.Net one) to get around a
problem. 99% of the time MS out-thinks us in a good way. But in that 1% of the time,
what a pain-in-the-neck programming can be.

I am going to play with this idea. There might be some problems with this because there
is quite a bit of onClientClick stuff in there.

Thanks again to everyone.


"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:d9969fad-1161-4195-842e-(E-Mail Removed)...
On Nov 17, 3:03 pm, "Jennifer Mathews" <waltersjenni...@live.com>
wrote:
> Wow. I have to change probably a couple of hundred of these and doing this in the code
> behind really is terrible. I was really hoping I could do this with a search & replace
> for all the ascx pages. Of well. Thanks for the replies.
>
> "Andrew Morton" <a...@in-press.co.uk.invalid> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Jennifer Mathews wrote:
> >> Can someone tell me what I am doing wrong?

>
> > Using <% %> inside a control won't necessarily work. Instead, you can set
> > cmdSave.ImageUrl in the Page_Load handler.

>
> > Andrew- Hide quoted text -

>
> - Show quoted text -


Another option could be converting ASP.NET control into HTML input
control

<input type="image" src='<%"/images/" & _s_CSS_Btn_DWhr & "/Save.jpg"
%>' />

which could act the same as ImageButton

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      18th Nov 2009
On Nov 18, 1:46*pm, "Jennifer Mathews" <waltersjenni...@live.com>
wrote:
> Actually, I just had to use the hyperlink HTML control (non ASP.Net one) to get around a
> problem. *99% of the time MS out-thinks us in a good way. *But in that 1% of the time,
> what a pain-in-the-neck programming can be.
>
> I am going to play with this idea. *There might be some problems with this because there
> is quite a bit of onClientClick stuff in there.
>
> Thanks again to everyone.
>
> "Alexey Smirnov" <alexey.smir...@gmail.com> wrote in message
>
> news:d9969fad-1161-4195-842e-(E-Mail Removed)...
> On Nov 17, 3:03 pm, "Jennifer Mathews" <waltersjenni...@live.com>
> wrote:
>
>
>
>
>
> > Wow. I have to change probably a couple of hundred of these and doing this in the code
> > behind really is terrible. I was really hoping I could do this with a search & replace
> > for all the ascx pages. Of well. Thanks for the replies.

>
> > "Andrew Morton" <a...@in-press.co.uk.invalid> wrote in message

>
> >news:(E-Mail Removed)...

>
> > > Jennifer Mathews wrote:
> > >> Can someone tell me what I am doing wrong?

>
> > > Using <% %> inside a control won't necessarily work. Instead, you canset
> > > cmdSave.ImageUrl in the Page_Load handler.

>
> > > Andrew- Hide quoted text -

>
> > - Show quoted text -

>
> Another option could be converting ASP.NET control into HTML input
> control
>
> <input type="image" src='<%"/images/" & _s_CSS_Btn_DWhr & "/Save.jpg"
> %>' * />
>
> which could act the same as ImageButton- Hide quoted text -
>
> - Show quoted text -


What you can also do is to try to use themes and skins. Because
personalization is exactly what they were designed for.
http://msdn.microsoft.com/de-de/library/wcyt4fxb(VS.80).aspx
 
Reply With Quote
 
Jennifer Mathews
Guest
Posts: n/a
 
      18th Nov 2009
That reference is in German and my German is not too good. Make that nonexistant.

"Alexey Smirnov" <(E-Mail Removed)> wrote in message
news:dc4524ad-259a-43c0-af55-(E-Mail Removed)...

What you can also do is to try to use themes and skins. Because
personalization is exactly what they were designed for.
http://msdn.microsoft.com/de-de/library/wcyt4fxb(VS.80).aspx

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: windows vista restore not working/blue screen help/safe mode not working nomore Windows Vista General Discussion 1 25th Jul 2009 12:04 AM
Calculating time difference using working days and working times Kevo Microsoft Access 6 1st May 2009 02:06 AM
Shared Addin not working in Excel and Word but working in Powerpoint Omer Microsoft VB .NET 0 2nd Dec 2007 08:06 PM
Re: Right click stops working/New tabs stop working/Menu bar disappear Robert Aldwinckle Windows Vista Performance 8 20th Nov 2007 09:03 PM
named pipes connection string working fine in .net EXE, but NOT working from asp.net thomasamillergoogle@yahoo.com Microsoft ADO .NET 0 9th Feb 2005 12:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:19 PM.