I have simplified my problem by only add code that is relevant for my example.
All relevant code is shown below.
When I start this page It will display all the image files that has been uploaded to the ftp server
When I want to upload an image file to the ftp server I select a file by using AsyncFileUpload browse control which cause this AsyncFileUpload1_Complete event handler to be called.
I send the file to the ftp server by using the method FileManager.HandleUpload(path, id); that is within the event handler AsyncFileUpload1_Complete
I insert the image file that I have uploaded to the server into the database by using this method backEnd.InsertIntoPictures(id, AsyncFileUpload1.FileName); that is within the
AsyncFileUpload1_Complete
Now I want my aspx page to do a partial update so I can see that my latest image file is displayed on the screen
I call DisplayCaseDetail(this.lblID.Text); that is at the end of AsyncFileUpload1_Complete
When I use the debugger I can see that the DataSet contain all the image files that have been send to the ftp server including the latest one.
As you can see I also bind the DataSet to Repeater2
The problem is that there is no change in the display of the image files even though the Repeater is bind to the correct data:
As you can see I have added the update panel, triggers, AsyncPostBackTrigger and ToolkitScriptManager to markup file
Can somebody guide me in the right direction why the screen is not doing a partial update of my image file that has been uploadet to the ftp server ?
private void DisplayCaseDetail(string id)
{
Case myCase = backEnd.GetCaseByID(id);
DataSet ds = backEnd.GetPictures(id);
if (ds.Tables[0].Rows.Count != 0)
{
Repeater2.DataSource = ds;
Repeater2.DataBind();
}
}
The markup file
************
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage3.master" AutoEventWireup="true"
CodeFile="CrimeInvestigator.aspx.cs" Inherits="investigator_CrimeInvestigator" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div id="rightColumn">
<asp:Repeater ID="Repeater2" runat="server">
<HeaderTemplate>
<table id="filer">
</HeaderTemplate>
<ItemTemplate>
<tr><td><asp:Label runat="server" ID="imageFile" text='<%# Eval("Pname") %>' /></td></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
<div id="bottomColumn">
<asp:AsyncFileUpload ID="AsyncFileUpload1" OnUploadedComplete="AsyncFileUpload1_OnUploadedComplete" runat="server" />
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="AsyncFileUpload1" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
protected void AsyncFileUpload1_Complete(object sender, AsyncFileUploadEventArgs e)
{
string id = Request.QueryString["ID"];
//Copy image file to temp katalogen
AsyncFileUpload1.PostedFile.SaveAs(path + e.FileName);
path += e.FileName;
//Upload bild to file ftp server
FileManager.HandleUpload(path, id);
//Uppdate daabase with this image file
backEnd.InsertIntoPictures(id, AsyncFileUpload1.FileName);
//Refresh page by reading the database Table picture so we can see that the new file has been uploaded
DisplayCaseDetail(this.lblID.Text);
}
//tony