473,395 Members | 1,647 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ImageURL Formating

I have a problem with the Image object and ImageURL. I've looked over
some forums however I've gotten nowhere but frustrated fast. I've
verified all the data and it's correct. No special characters, just
alpha-numeric and an occasional slash(/).

I pass the following URL to my image,
"charts.aspx?labels=<data>&Data=<data>&title=<data >"

However it is formated differently,
"charts.aspx?labels=<data>&amp;Data=<data>&amp;xTi tle=<data>

Here is some test code for the values
if(Request.QueryString["Labels"] == null)
Response.Write("Labels is null<br />");
else
Response.Write("Labels = " + Request.QueryString["Labels"].ToString()
+ "<br/>");
if(Request.QueryString["Data"] == null)
Response.Write("Data is null<br />");
else
Response.Write("Data = " + Request.QueryString["Data"].ToString() +
"<br/>");
if(Request.QueryString["xTitle"] == null)
Response.Write("xTitle is null<br />");
else
Response.Write("xTitle = " + Request.QueryString["xTitle"].ToString()
+ "<br/>");

Which yields the following
Labels = <data>
Data is null
xTitle is null

If I substitue Request.QueryString["data"] with
Request.QueryString["amp;data"] everything works. What am I missing?

Aug 14 '06 #1
2 1830
Why are you doing this on the query string? You can dynamically add images
to an image control in code behind without having the extra page hit. The
only time this will not work is when you do not take a server trip, but your
code is embedded in the tags, so this does not appear to be the case.

<asp:Image imageUrl="notFound.gif" runat="server" id="Image1" />

CodeBehind:

string label = Request["labels"];
string data = Request["data"];
string title = Request["title"];

Image1.ImageUrl = CalculateImageUrl(label, data, title);

You then move the code to figure out which image to the CalculateImageUrl()
routine.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think outside of the box!
*************************************************
"Jokerr" <ke*********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
>I have a problem with the Image object and ImageURL. I've looked over
some forums however I've gotten nowhere but frustrated fast. I've
verified all the data and it's correct. No special characters, just
alpha-numeric and an occasional slash(/).

I pass the following URL to my image,
"charts.aspx?labels=<data>&Data=<data>&title=<data >"

However it is formated differently,
"charts.aspx?labels=<data>&amp;Data=<data>&amp;xTi tle=<data>

Here is some test code for the values
if(Request.QueryString["Labels"] == null)
Response.Write("Labels is null<br />");
else
Response.Write("Labels = " + Request.QueryString["Labels"].ToString()
+ "<br/>");
if(Request.QueryString["Data"] == null)
Response.Write("Data is null<br />");
else
Response.Write("Data = " + Request.QueryString["Data"].ToString() +
"<br/>");
if(Request.QueryString["xTitle"] == null)
Response.Write("xTitle is null<br />");
else
Response.Write("xTitle = " + Request.QueryString["xTitle"].ToString()
+ "<br/>");

Which yields the following
Labels = <data>
Data is null
xTitle is null

If I substitue Request.QueryString["data"] with
Request.QueryString["amp;data"] everything works. What am I missing?

Aug 14 '06 #2
I should have specified more, my bad. The charts.aspx file is used by
many different pages. charts.aspx takes in the parameters and creates
the image based on the parameters. Thus the image is different each
time and why I'm using QueryString. The main issue, IMO, is how the
image control formats the url.

In the other file (the one using the image control) I have the
following:
<asp:Image ID="imgChart" runat="server" AlternateText="Encounters
chart." />

After the user fires off the event I build the parameters and set the
imgChart.ImageURL accordingly.

charts.aspx?label=value&data=value&xTitle=value is sent to the browser
as
charts.aspx?label=value&amp;data=value&amp;xTitle= value.

charts.aspx?label=value&amp;data=value&amp;xTitle= value is sent to the
browser as
charts.aspx?label=value&amp;amp;data=value&amp;amp ;xTitle=value.

Request.QueryString["data"] is always null in charts.aspx. How can I
tell the image control not to format the & sign?

Cowboy (Gregory A. Beamer) wrote:
Why are you doing this on the query string? You can dynamically add images
to an image control in code behind without having the extra page hit. The
only time this will not work is when you do not take a server trip, but your
code is embedded in the tags, so this does not appear to be the case.

<asp:Image imageUrl="notFound.gif" runat="server" id="Image1" />

CodeBehind:

string label = Request["labels"];
string data = Request["data"];
string title = Request["title"];

Image1.ImageUrl = CalculateImageUrl(label, data, title);

You then move the code to figure out which image to the CalculateImageUrl()
routine.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Aug 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Leigh Kendall | last post by:
I can't find any issue in the MS KB, but I'm experiencing the following problem which seems to be specific to IE5, and NOT any other version of IE 5.5+ or NN 6+. Issue: I'm using an asp.net...
4
by: Ben | last post by:
Hi, I'm using images in my menu control. I have my menu setup based on this example: http://msdn2.microsoft.com/en-US/library/system.web.ui.webcontrols.menuitembinding.imageurlfield(VS.80).aspx ...
3
by: Thomas Satzinger | last post by:
Hallo., i just encounterd a strange thing which i cannot resolve. I am saving a bitmap created in memory to the asp temp folder (asp.net 2.0) this works fine, and i donīt want to create an...
0
by: Jeff | last post by:
Hey ASP.NET 2.0 I'm working on a website which I want the menu control to have images to left for the text in the menuitem... So far I've read that this can be done by providing the ImageUrl...
1
by: wardemon | last post by:
Hi, I have an image control which inside an ItemTemplate of a GridView Control. I've coded the ImageControl's ImageURL in "Source" to have a dynamically filled-up value ex: ImageURL = <%#...
0
by: Fonix | last post by:
I'm trying to make table border with pyExcelerator. As i can see there is only cell formating!? If i'm wrong pls tell me what is method to make more then one cell to have same format, other then...
2
by: sitko | last post by:
Hi, I'm in the process of converting a VB.net program into a C program so it can run on a unix like machine. I've been moving along at a nice pace, but this conversion has stumped me. I need...
1
by: BillGatesFan | last post by:
Is there a way to change to swapimages for an imagemap in asp.net upon postback on the server? Thanks!
5
by: OK | last post by:
I am using an image control to display some images within a virtual map (ImagesRoot in IIS) outside of the web root in my vb asp.net application. How should I code the imageurl property to have...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.