Update Panel is not working over there "OnSelectedIndexChanged" Event which is inside a repeater

714 views Asked by At

I have put an update panel in a page and its working properly.In that page i was loading an repeater and its also working properly.But inside that repeater i am firing an event "OnSelectedIndexChanged" in a dropdownList .while using it the page is getting refreshed. seems update panel is not working over there.

<asp:UpdatePanel ID="update_invest" runat="server" UpdateMode="Always">
  <ContentTemplate>
 <asp:Repeater ID="rptinvest" runat="server" OnItemDataBound="rptactions_ItemDataBound">
   <ItemTemplate>
     <td>
    <asp:DropDownList ID="ddlemployee" runat="server" OnSelectedIndexChanged="ddlEmployee_SelectedIndexChanged"
   AppendDataBoundItems="true" AutoPostBack="True">
   </asp:DropDownList>
   </td>
   </ItemTemplate>
  </asp:Repeater>

the above is the code....!!

Thanks Arshad..!

1

There are 1 answers

2
Pyae Phyo Aung On

I think you need to register the postback triggering controls inside update panel. In your code snippet, it is ddlemployee. If it was in the mark up, you can do so like:

<Triggers>
 <asp:AsyncPostBackTrigger ControlID="ddlemployee" EventName="OnSelectedIndexChanged" />
 </Triggers>
</asp:UpdatePanel>

However, drop down control is nested inside repeater that you have to register it from code behind like:

For Each item As RepeaterItem In rptinvest.Items

 Dim ddlemployee As DropDownList = DirectCast(item.FindControl("ddlemployee"), DropDownList)
 ScriptManager1.RegisterAsyncPostBackControl(ddlemployee)

Next

Hope this help you. Visit here for more information about update panel and triggers.