Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > inline codeblock doesnt run

Reply
Thread Tools

inline codeblock doesnt run

 
 
Nime
Guest
Posts: n/a
 
      01-28-2009

This codeblock has no problem.

XXX<%= 19690 %>YYY


Next inline codeblock doesn't run below.


<asp:Image runat="server" ID="img"
ImageUrl="image.aspx?id=1&key=<%=19690 %>" />


I just wanted to write key value for the image. Any idea?
 
Reply With Quote
 
 
 
 
Nime
Guest
Posts: n/a
 
      01-28-2009
PS: Generated image source url in html is:

<img src=http://localhost:3048/image.aspx?id=1&key=<%=19690 %>" ...



 
Reply With Quote
 
 
 
 
MarkD
Guest
Posts: n/a
 
      01-28-2009
I can reproduce your problem using a simple aspx page as below:

<%@ Page language="c#" AutoEventWireup="true" %>
<html>
<body >
<form id="Form1" method="post" runat="server" action="?<
%=Request.QueryString%>">
Query String value: <%=Request.QueryString %>
<br />
<input type=submit />
</form>
</body>
</html>

This displays the following after submitting the form:
Query String value: %3c%25=Request.QueryString%25%3e

For some reason, the inline code is not executed when the
runat="server" is present. The strange thing is I have 3 machines
that do not behave this way and one that does, so I can only assume
that this is an IIS/.NET config issue, possibly caused by a recent MS
Update. The software I have installed recently on the machine
exhibiting this behaviour is:
Visual Studio 2008
WSE 3.0
IE8 RC1

I wonder if any of these have caused this?




On 28 Jan, 14:10, "Nime" <(E-Mail Removed)> wrote:
> This codeblock has no problem.
>
> XXX<%= 19690 %>YYY
>
> Next inline codeblock doesn't run below.
>
> <asp:Image runat="server" ID="img" *
> ImageUrl="image.aspx?id=1&key=<%=19690 %>" />
>
> I just wanted to write key value for the image. Any idea?


 
Reply With Quote
 
Nime
Guest
Posts: n/a
 
      01-28-2009
I also use VS2008 SP1 + XP Pro SP3.

I found these links:

Embedding dynamic values:
http://www.west-wind.com/Weblog/posts/5364.aspx

Inline asp.net tags:
http://naspinski.net/post/inline-asp...252c-etc).aspx

Embedded code blocks:
http://msdn.microsoft.com/en-us/libr...35(vs.80).aspx


Now I'm stuck : (



 
Reply With Quote
 
iduditz
Guest
Posts: n/a
 
      01-29-2009
<% %> are not allowed in server controls. When you embedded halfway into
your imageurl property, the compiler wasnt able to tell you the issue

<asp:image id="bla" imageurl="blabla<%= 234 %>" /> doesnt show the error but
<asp:image id="bla" imageurl="<%=234" /> does

try using an html control instead:
<img id="myimage" src="<%=123 %>" />

or use data binding



> Embedding dynamic values:
> http://www.west-wind.com/Weblog/posts/5364.aspx
>
> Inline asp.net tags:
> http://naspinski.net/post/inline-asp...252c-etc).aspx
>
> Embedded code blocks:
> http://msdn.microsoft.com/en-us/libr...35(vs.80).aspx
>
>
> Now I'm stuck : (
>
>
>
>

 
Reply With Quote
 
MarkD
Guest
Posts: n/a
 
      01-29-2009
iduditz can you point me to any MS documentation that states this? <%
%> has worked in server side controls in the web app I work on for
years, and even now works on all but one win2003 server - I just can't
work out what the difference is for this one machine, and suspect it
may be a .NET Framework update...


On 29 Jan, 04:05, iduditz <(E-Mail Removed)> wrote:
> <% * * * %> are not allowed in server controls. When you embedded halfway into
> your imageurl property, the compiler wasnt able to tell you the issue
>
> <asp:image id="bla" imageurl="blabla<%= 234 %>" /> doesnt show the error but
> <asp:image id="bla" imageurl="<%=234" /> does
>
> try using an html control instead:
> <img id="myimage" src="<%=123 %>" />
>
> or use data binding
>
> > Embedding dynamic values:
> >http://www.west-wind.com/Weblog/posts/5364.aspx

>
> > Inline asp.net tags:
> >http://naspinski.net/post/inline-asp...em-all-out-(3c...

>
> > Embedded code blocks:
> >http://msdn.microsoft.com/en-us/libr...35(vs.80).aspx

>
> > Now I'm stuck * *: (


 
Reply With Quote
 
Andrew Morton
Guest
Posts: n/a
 
      01-29-2009
Is what you want simply

<asp:Image runat="server" ID="img" ImageUrl="image.aspx?id=1&key=19690" />

?

Andrew


 
Reply With Quote
 
MarkD
Guest
Posts: n/a
 
      01-29-2009
I've uninstalled the .NET framework while investigating this (3.5 then
3.0 and 2.0) - I then had no problems after
Installing each of the following:
..net framework 2.0
..net framework 2.0 SP1
..net framework 3.0
..net framework 3.0 SP1
..net framework 3.5

But after I installed .net framework 3.5 SP1 the behaviour returned –
I guess this is the issue. I have raised this with Microsoft and will
update this thread when I get a response.


On 29 Jan, 09:12, MarkD <(E-Mail Removed)> wrote:
> iduditz can you point me to any MS documentation that states this? *<%
> %> has worked in server side controls in the web app I work on for
> years, and even now works on all but one win2003 server - I just can't
> work out what the difference is for this one machine, and suspect it
> may be a .NET Framework update...
>
> On 29 Jan, 04:05, iduditz <(E-Mail Removed)> wrote:
>
> > <% * * * %> are not allowed in server controls. When you embedded halfway into
> > your imageurl property, the compiler wasnt able to tell you the issue

>
> > <asp:image id="bla" imageurl="blabla<%= 234 %>" /> doesnt show the error but
> > <asp:image id="bla" imageurl="<%=234" /> does

>
> > try using an html control instead:
> > <img id="myimage" src="<%=123 %>" />

>
> > or use data binding

>
> > > Embedding dynamic values:
> > >http://www.west-wind.com/Weblog/posts/5364.aspx

>
> > > Inline asp.net tags:
> > >http://naspinski.net/post/inline-asp...em-all-out-(3c....

>
> > > Embedded code blocks:
> > >http://msdn.microsoft.com/en-us/libr...35(vs.80).aspx

>
> > > Now I'm stuck * *: (


 
Reply With Quote
 
Nime
Guest
Posts: n/a
 
      01-29-2009
Yes but I have to display different image every time...



I tried to use a function and set a breakpoint. That breakpoint never be hit,
I also tried to rename the function for testing purpose, then an error occured.

<asp:Image runat="server" ID="img" ImageUrl='<%# getUrl(19690) %>' />

public string getUrl(int key)
{
return "image.aspx?id=1&key=" + key; // I set breakpoint here
}


"Andrew Morton" <(E-Mail Removed)>, iletide şunu yazdı news:(E-Mail Removed)...
> Is what you want simply
>
> <asp:Image runat="server" ID="img" ImageUrl="image.aspx?id=1&key=19690" />
>
> ?
>
> Andrew
>

 
Reply With Quote
 
Nime
Guest
Posts: n/a
 
      01-29-2009
Is it a bug then? Or just a feature : ) Oh Microsoft...

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
different output in ideone and codeblock Mayank Jain C Programming 2 01-27-2013 06:45 PM
sort list doesnt work, key=str still doesnt work notnorwegian@yahoo.se Python 3 05-27-2008 04:32 AM
Feeding a codeblock/function with an array or something similar? kazaam Ruby 5 09-04-2007 02:33 PM
PC doesnt boot first time and doesnt shutdown dann Computer Support 6 08-21-2006 07:31 AM
inline or not to inline in C++ Abhi C++ 2 07-03-2003 12:07 AM



Advertisments