The key point here is that my customer's page is not an aspx. It's just an htm. In that htm page, you include the script with the src to my aspx and the I have to respond something like "document.write('<img .. alt ......')
This trick will to the work, but It's not working in ASP.NET and it's working in the old ASP.
Do you know other way to do this?
Thanks for your help in this.
Ariel
Why isn't it possible? Just add runat="server" to turn <img> into a server-side control and databind both src and alt attributes.
Eliyahu
The thing is that my client also wants to show in the alt some information that is also in the database. So I must create the whole tag in runtime, with a document.write
This can be a solution, <img src="GetImage.aspx?id=12345" alt="GetTag.aspx?id=12345">
but it's not possible because it is going to be used in a search page and may have hundreds of records.
Ariel
Then your image tag should look like
<img src="GetImage.aspx?id=12345">
GetImage.aspx will get the image id, find the image in the database and stream it down to the browser.
If your database is SQL Server, you can declare
System.Data.SqlTypes.SqlBinary image;
load it from database and sream it down as
Response.ContentType = "image/gif";
Response.BinaryWrite (image.Value);
Eliyahu
I must show different images depending on parameters. and also, the img tag should display something from the database, that's why I thing that if the client puts a script with the aspx and the parameters shuld work.
The most funny thing here is that I did this in an old ASP and worked fine. I don't know why is not working here.
Any ideas?
Ariel
Ariel,
Looks like you need just a hyperlink something like <a href="test.aspx?parameter1=par1¶meter2=par2">Click here</a>
It is still not clear what is your final goal for the users. Do you want to show different images depending on the parameters? Then there is another way of doing this.
Eliyahu
I want my clients put a script in an htm file with the src linked to an aspx page with some parameters. Then my aspx will response a <img> tag (something like document.wirte('<img...'>); ) depending on the parameters.
Ariel
Ariel,
Your script is supposed to be a javascript file. But it is an asp.net page.
What do you want to achieve?
Eliyahu