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
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>Untitled Page</title>
- <script language="javascript" type="text/javascript">
- function test()
- {
- debugger;
- var str;
- str=document.getElementById("FileUpload1").value;
- alert(document.getElementById("FileUpload1").value);
- window.open('DisplayImage.aspx?url='+str,'','height=300,Width=300,Status=no,toolbar=no,Menubar=no,Location=noresizable=yes');
- }
- </script>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <table>
- <tr>
- <td>
- <asp:FileUpload ID="FileUpload1" runat="server" Height="25px" Width="240px" />
- </td>
- </tr>
- <tr>
- <td>
- <asp:Button ID="btnUpload" runat="server" Text="Button" OnClientClick ="test()" />
- </td>
- </tr>
- <tr>
- <td>
- <asp:Label ID="lblmessage" runat="server" Text="Label"></asp:Label>
- </td>
- </tr>
- </table>
- </div>
- </form>
- </body>
- </html>
//page in which image is displayed
Expand|Select|Wrap|Line Numbers
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayImage.aspx.cs" Inherits="DisplayImage" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" >
- <head runat="server">
- <title>Untitled Page</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- <table>
- <tr>
- <td>
- <asp:Image ID="Image1" runat="server" Height="200px" Width="200px" />
- </td>
- </tr>
- </table>
- </div>
- </form>
- </body>
- </html>
{
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