Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
281
Problem using WebAsyncRefreshPanel with web usercontrol
posted

Hi All,

I am using NetAdvantage NET 20081 CLR20. I implemented the WebAsyncRefreshPanel in my web application. I used in one usercontrol let say, myControl1, and myControl1 is again used in myControl2 and myControl2 is displayed on default.aspx. Fllowing is the way I implemented.

myControl1:HTML View
-----------------------------------
<table id="Table1" cellSpacing="1" cellPadding="1" width="300" border="0">
<tr>
 <td style="HEIGHT: 24px"><asp:label id="lblMainHeading" CssClass="secondHeading" runat="server">Pacsmail Images</asp:label></td>
</tr>
<tr>
 <td><asp:image id="imgPacsmail" runat="server"></asp:image></td>
</tr>
<tr>
 <td align="center">
 <igmisc:WebAsyncRefreshPanel ID="WebAsyncRefreshPanel1" runat="server" Height="20px" Width="80px">
  <asp:label id="lblPrevious" CssClass="stdLabel" runat="server">Previous</asp:label>
  <asp:imagebutton id="imgBtnPreviousImage" runat="server" ImageUrl="~/Images/leftArrow.gif"></asp:imagebutton>
  <asp:imagebutton id="imgBtnNextImage" runat="server" ImageUrl="~/Images/rightArrow.gif"></asp:imagebutton>
  <asp:label id="lblNext" CssClass="stdLabel" runat="server">Next</asp:label>
 </igmisc:WebAsyncRefreshPanel>
 </td>
</tr>
</table>

 

myControl1: CodeBehind C#
-----------------------------------------

protected void Page_Load(object sender, System.EventArgs e)
{
   this.imgBtnPreviousImage.Click += new System.Web.UI.ImageClickEventHandler(this.imgBtnPreviousImage_Click);
   this.imgBtnNextImage.Click += new System.Web.UI.ImageClickEventHandler(this.imgBtnNextImage_Click);

   this.WebAsyncRefreshPanel1.AddLinkedRequestTrigger("imgBtnPreviousImage");
   this.WebAsyncRefreshPanel1.AddLinkedRequestTrigger("imgBtnNextImage");
   this.WebAsyncRefreshPanel1.AddRefreshTarget("imgPacsmail");
}

public void Display(int reportID)
  {
   #region Pacsmail Images
   string pathPacsmailImages = Server.MapPath(".") + "\\Images\\Pacsmail\\" + reportID.ToString();

   if(PacsmailImagesAvailable(pathPacsmailImages, reportID))
   {
    arrPacsmailImages = Directory.GetFiles(pathPacsmailImages);
    //imgPacsmail.ImageUrl = arrPacsmailImages[pacsmailImage].Replace(Server.MapPath("."), "~/..").Replace("\\", "/");
    if (FileIsAnImage(arrPacsmailImages[pacsmailImage]))
    {
     imgPacsmail.Visible = true;
     imgPacsmail.ImageUrl = arrPacsmailImages[pacsmailImage].Replace(Server.MapPath("."), "~").Replace("\\", "/");
    }
    else
    {
     imgPacsmail.Visible = false;
    }
   }
   else
   {
    lblMainHeading.Visible = false;
    imgPacsmail.Visible = false;
    lblPrevious.Visible = false;
    lblNext.Visible = false;
    imgBtnPreviousImage.Visible = false;
    imgBtnNextImage.Visible = false;
   }
   #endregion
  }

myControl1 in myControl2
<td>
   <uc1:pacsmailimagesslideshow id="PacsmailImagesSlideShow1" runat="server"></uc1:pacsmailimagesslideshow>
</td>

myControl2: PageLoad
--------------------------------
if((Request.QueryString.Get("type") != null) && (Request.QueryString.Get("reportid") != null))
   {
    ControlsPanel.Visible = false;
    resultsGrid.Visible = false;
    string type = "";
    int reportID = 0;

    try
    {
     type = Request.QueryString.Get("type").ToString();
     reportID = Convert.ToInt32(Request.QueryString.Get("reportid"));
    }
    catch
    {
    }

    DisplayReferralReports(type, reportID);
   }

PacsmailImagesSlideShow1.Display(reportID); is called inside  DisplayReferralReports(type, reportID) function.

It simply did not work. nothing happens, the image should change when user clicks on the next or prev button without post back. but nothing happens at all. when i remove the panel it works with a postback.

Need some help and suggestions.

 

Kind regards,


 

  • 19308
    posted

    In the setup you have, the WARP panel will refresh it's contents, as well as the image with id imgPacsmail.  No other content will be updated.  It appears that you want your usercontrol to be updated, but your usercontrol lies outside of the WARP, and isn't linked as a Refresh Target.  In order to update your usercontrol, you'll want to place it in a second WARP panel, and add the second WARP panel as a RefreshTarget of the first WARP panel.

    Hope this helps,

    -Tony