ali raza

ali raza

  • NA
  • 80
  • 0

Unable to use PopupControlExtender inside repeater control

Sep 27 2011 2:08 AM
Hi All, I am having problem in using ASP.Net AJAX PopupControlExtender connected with Calendar control in side panel control. All these conttrols are enclosed in repeater. Now the problem is SelectionChanged event of  Calendar control is not firing so that I can select the date. following is the code:

HTML
<


table><asp:Repeater ID="rptInstallment" runat="server">

<HeaderTemplate>

<tr>

<td>Installment Number


</td>

<td>Date


</td>

<td>Amount


</td>

</tr>

</HeaderTemplate>

<ItemTemplate>

<tr>

<td>

<asp:Label ID="lblInstallmentNumber" runat="server" />

</td>

<td>

<asp:TextBox ID="txtCalendar" runat="server" />

<asp:Panel ID="pnlCalendar" runat="server" CssClass="popupControl">

<asp:UpdatePanel ID="upCalendar" runat="server">

<ContentTemplate>

<asp:Calendar ID="cldDate" runat="server" OnSelectionChanged="cldDate_SelectionChanged" />

</ContentTemplate>

</asp:UpdatePanel>

</asp:Panel>

<asp:PopupControlExtender ID="pceCalendar" runat="server" CommitProperty="value"

Position="Right" TargetControlID="txtCalendar" PopupControlID="pnlCalendar" OffsetX="2"

OffsetY="2" />

</td>

<td>

<asp:TextBox ID="txtAmount" runat="server" />

<asp:CompareValidator ID="cvAmount" runat="server" ErrorMessage="Amount must be in numbers"

ControlToValidate="txtAmount" Type="Integer" Operator="DataTypeCheck" />

</td>

</tr>

</ItemTemplate>

</asp:Repeater>

</table>



C#


protected void rptInstallment_ItemDataBound(object sender, RepeaterItemEventArgs e)
  {
  try
  {
  if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
  {
  CreditTenure objCreditTenure = e.Item.DataItem as CreditTenure;
  ((Label)e.Item.FindControl("lblInstallmentNumber")).Text = objCreditTenure.InstallmentNo.ToString();
  Calendar cldDate = (Calendar)e.Item.FindControl("cldDate");
 
  cldDate.SelectionChanged += new EventHandler(cldDate_SelectionChanged);
  }
  }
  catch (Exception)
  {
  throw;
  }
  }

  protected void cldDate_SelectionChanged(object sender, EventArgs e)
  {
  try
  {
  pceCalendar.Commit(cldDate.SelectedDate.ToLongDateString());
  }
  catch (Exception)
  {
  throw;
  }
  }




another problem is that I am not able to find PopupControlExtender control in the SelectionChanged event as it is in side repeater control




any Help inthis regards would be heighly appreciated