charan sekhar

charan sekhar

  • NA
  • 108
  • 0

uploading the image and displaying but next time not displaying the image

Apr 27 2010 9:41 AM

hi , iam using asp.net with c#,
in my page iam displaying old image and new image .   then  iam uploading and updating the images .the  new image will be the newlly uploaded and display in new image control and previous image was displaying in new image control will display in
old image control .
 the problem is when i am redirecting to othe pages and came back to same page then modified  images are not displayed
old images are displaying.... how to solve this problem can you give me example which helps me
 
<
body>
<form id="form1" runat="server">
<div>
<asp:ImageButton ID="New" runat="server" Height="256px" ImageUrl="~/Nectarbig.JPG"
OnClick="ImageButton1_Click" Style="z-index: 100; left: 0px; position: absolute;
top: 0px"
Width="336px" />
<asp:ImageButton ID="Old" runat="server" Height="192px" Style="z-index: 101;
left: 424px; position: absolute; top: 56px"
Width="288px" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Style="z-index: 102;
left: 120px; position: absolute; top: 432px"
Text="Button" />
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" Style="z-index: 105;
left: 880px; position: absolute; top: 24px">
next</asp:LinkButton>
<asp:FileUpload ID="FileUpload1" runat="server" Style="z-index: 104; left: 96px;
position: absolute; top: 392px"
/>
&nbsp;

</div>
</form>
</
body>
 
protected
void Button1_Click(object sender, EventArgs e)
{
//Label1.Text = "Hello Click Here";
string fn=FileUpload1.PostedFile.FileName;
string[]fi=fn.Split('\\');
string name=fi[fi.Length-1];
FileUpload1.PostedFile.SaveAs(Server.MapPath(
"images/"+name));
Old.ImageUrl = New.ImageUrl;
New.ImageUrl =
"~/images/" + FileUpload1.FileName;

}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect(
"resizableextender.aspx");
}

 

Answers (2)