By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,237 Members | 472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,237 IT Pros & Developers. It's quick & easy.

Image is displaying in Internet Explorer 6.0 but not in I.E. 7.0

P: 30
Dear All
Iam using file upload control and i want to display image in another pop up page
.But image is not displaying in image control iam sending image path thru querystring . here is my code
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8.     <script language="javascript" type="text/javascript">
  9.     function test()
  10.         {
  11.         debugger;
  12.         var str;
  13.         str=document.getElementById("FileUpload1").value;
  14.         alert(document.getElementById("FileUpload1").value);
  15.         window.open('DisplayImage.aspx?url='+str,'','height=300,Width=300,Status=no,toolbar=no,Menubar=no,Location=noresizable=yes');
  16.         }
  17.     </script>    
  18.  
  19. </head>
  20. <body>
  21.     <form id="form1" runat="server">
  22.     <div>
  23.        <table>
  24.         <tr>
  25.             <td>
  26.                 <asp:FileUpload ID="FileUpload1" runat="server" Height="25px" Width="240px" />
  27.             </td>
  28.         </tr>
  29.         <tr>
  30.             <td>
  31.                 <asp:Button ID="btnUpload" runat="server" Text="Button" OnClientClick ="test()"  />
  32.             </td>
  33.         </tr>
  34.         <tr>
  35.             <td>
  36.                 <asp:Label ID="lblmessage" runat="server" Text="Label"></asp:Label>
  37.             </td>
  38.         </tr>
  39.        </table>
  40.     </div>
  41.     </form>
  42. </body>
  43. </html>
  44.  
  45.  
[code]
//page in which image is displayed
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayImage.aspx.cs" Inherits="DisplayImage" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.     <table>
  13.         <tr>
  14.         <td>
  15.  
  16.  
  17.             <asp:Image ID="Image1"  runat="server" Height="200px" Width="200px" />
  18.         </td>
  19.         </tr>
  20.     </table>
  21.     </div>
  22.     </form>
  23. </body>
  24. </html>
  25.  
public partial class DisplayImage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string s;
if (!IsPostBack)
{
s = Request.QueryString["url"].ToString();
//Image1.Src = s;

//Image1 = new Image();
Image1.ImageUrl= s.ToString();
Image1.Visible = true;
Response.Write(s);
}
}
}

thankx in advance

yogesh
Jun 27 '08 #1
Share this Question
Share on Google+
7 Replies

P: 30
Dear All
I have created an application to diaplay image in popup window. In Internet explorer 6.0 image is displayed but not in Internet Explorer 7.0
Here is my code
Dear All
Iam using file upload control and i want to display image in another pop up page
.But image is not displaying in image control iam sending image path thru querystring . here is my code


Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8.     <script language="javascript" type="text/javascript">
  9.     function test()
  10.         {
  11.         debugger;
  12.         var str;
  13.         str=document.getElementById("FileUpload1").value;
  14.         alert(document.getElementById("FileUpload1").value);
  15.         window.open('DisplayImage.aspx?url='+str,'','heigh  t=300,Width=300,Status=no,toolbar=no,Menubar=no,Lo  cation=noresizable=yes');
  16.         }
  17.     </script>    
  18.  
  19. </head>
  20. <body>
  21.     <form id="form1" runat="server">
  22.     <div>
  23.        <table>
  24.         <tr>
  25.             <td>
  26.                 <asp:FileUpload ID="FileUpload1" runat="server" Height="25px" Width="240px" />
  27.             </td>
  28.         </tr>
  29.         <tr>
  30.             <td>
  31.                 <asp:Button ID="btnUpload" runat="server" Text="Button" OnClientClick ="test()"  />
  32.             </td>
  33.         </tr>
  34.         <tr>
  35.             <td>
  36.                 <asp:Label ID="lblmessage" runat="server" Text="Label"></asp:Label>
  37.             </td>
  38.         </tr>
  39.        </table>
  40.     </div>
  41.     </form>
  42. </body>
  43. </html>
  44.  
  45.  
//page in which image is displayed
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayImage.aspx.cs" Inherits="DisplayImage" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.     <table>
  13.         <tr>
  14.         <td>
  15.  
  16.  
  17.             <asp:Image ID="Image1"  runat="server" Height="200px" Width="200px" />
  18.         </td>
  19.         </tr>
  20.     </table>
  21.     </div>
  22.     </form>
  23. </body>
  24. </html>
  25.  
Expand|Select|Wrap|Line Numbers
  1. public partial class DisplayImage : System.Web.UI.Page
  2. {
  3. protected void Page_Load(object sender, EventArgs e)
  4. {
  5. string s;
  6. if (!IsPostBack)
  7. {
  8. s = Request.QueryString["url"].ToString();
  9. //Image1.Src = s;
  10.  
  11. //Image1 = new Image();
  12. Image1.ImageUrl= new Uri(s).ToString();
  13. Image1.Visible = true;
  14. Response.Write(s);
  15. }
  16. }
  17. }
  18.  
thankx in advance

yogesh
Jun 27 '08 #2

Frinavale
Expert Mod 5K+
P: 9,731
//page in which image is displayed
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayImage.aspx.cs" Inherits="DisplayImage" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8. </head>
  9. <body>
  10.     <form id="form1" runat="server">
  11.     <div>
  12.     <table>
  13.         <tr>
  14.         <td>
  15.  
  16.  
  17.             <asp:Image ID="Image1"  runat="server" Height="200px" Width="200px" />
  18.         </td>
  19.         </tr>
  20.     </table>
  21.     </div>
  22.     </form>
  23. </body>
  24. </html>
  25.  
Expand|Select|Wrap|Line Numbers
  1. public partial class DisplayImage : System.Web.UI.Page
  2. {
  3. protected void Page_Load(object sender, EventArgs e)
  4. {
  5. string s;
  6. if (!IsPostBack)
  7. {
  8. s = Request.QueryString["url"].ToString();
  9. //Image1.Src = s;
  10.  
  11. //Image1 = new Image();
  12. Image1.ImageUrl= new Uri(s).ToString();
  13. Image1.Visible = true;
  14. Response.Write(s);
  15. }
  16. }
  17. }
  18.  
thankx in advance

yogesh
Why are you using Response.Write?
Response.Write sometimes puts the content before the <html> tags in the page and this could be why things are not displaying.

-Frinny
Jun 27 '08 #3

Curtis Rutland
Expert 2.5K+
P: 3,256
Why are you using Response.Write?
Response.Write sometimes puts the content before the <html> tags in the page and this could be why things are not displaying.

-Frinny
As far as I've seen, Response.Write always puts the content before the <html> tags.
Jun 27 '08 #4

P: 30
As far as I've seen, Response.Write always puts the content before the <html> tags.
If i comment response.write then also image is not displayed in I.E. 7.0
but dispalyed in I.E. 6.0
Jun 29 '08 #5

P: 30
I want to display image in server machine and image resides in client machine using asp.net c#

Regards
Yogesh
Jun 30 '08 #6

Curtis Rutland
Expert 2.5K+
P: 3,256
http://bytes.com/forum/thread800754.html

Don't double post. Bump your old thread if necessary.
Jun 30 '08 #7

Frinavale
Expert Mod 5K+
P: 9,731
If i comment response.write then also image is not displayed in I.E. 7.0
but dispalyed in I.E. 6.0
As a rule, do not use Response.Write because it creates invalid HTML documents.

Run your application, right click on the page rendered in the browser and select View Code. Copy the line that contains the HTML that should be displaying the image (the <img> tag) and paste it here so that we can see what's wrong with it.


-Frinny
Jun 30 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.