简体   繁体   中英

Asp image button click event not firing for all row when it is inside a update panel which is inside a grid view

I am facing a strange problem. Inside a grid view I have some image button which is again inside update panel to load some calendar content with partial post back without any page refresh. This partial postback is working for first few rows but after few rows, lets say around 15 rows the button click event not hitting and only breakpoint going in page load event and the the entire page refresh.

there are huge data in each row but I am for example showing the update panel structure. please help me to fix the issue. I have tried various way to fix it but still facing same issue.

<asp:GridView ID="GVSales" runat="server" AllowPaging="false" AutoGenerateColumns="false" DataKeyNames="UserId" BackColor="#FFFFCC" EmptyDataText="No salesman selected to show" OnRowDataBound="GVSales_OnRowDataBound" OnDataBound="GVSales_AfterDataBound">
     <PagerSettings Visible="false" />
     <AlternatingRowStyle BackColor="#99CCFF" />
     <Columns>
     <asp:BoundField DataField="GroupName" Visible="false" />
     <asp:TemplateField>
     <ItemTemplate>
     <table width="100%" border="1px" cellpadding="0" cellspacing="0" style="color: Black; font-family: Arial; text-align: center">
     <tr>
     <td colspan="18" style="text-align: left">
     <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
     <ContentTemplate>
     <div>
     <div id="divNavigateCal" runat="server" style="float: right; display: none">
     <asp:HiddenField ID="hdnDaydiff" runat="server" Value="1" />
     <div class="blink" id="BlinkLoad" style="width: 100px; padding-top: 10px; vertical-align: top; display: none">Please Wait...</div>
     <asp:ImageButton ID="imgBtnPrevious" AutoPostback="false" runat="server" class="Previous" CommandArgument='<%# Eval("UserId")%>' Customid='<%# Eval("UserId") %>' OnClientClick='<%# "GetCustomerID(" + Eval("UserId") + ");" %>' ImageUrl="~/admin/images/cal_previous.gif" OnClick="imgBtnPrevious_Click" />
     <asp:ImageButton ID="imgBtnNext" runat="server" class="Next" CommandArgument='<%# Eval("UserId")%>' Customid='<%#  Eval("UserId") %>' OnClientClick='<%# "GetCustomerID(" + Eval("UserId") + ");" %>' ImageUrl="~/admin/images/cal_next.gif" OnClick="imgBtnNext_Click"/> 
     </div>
     <input type="button" class="ShowCalendar" value="Show/Hide Calendar" runat="server" data-id='<%# Eval("UserId")%>' /> <asp:Label ID="lbl_alert1" runat="server" Text="Started this week with low meetings" ForeColor="Red" Font-Bold="true" Width="300" Visible='<%# (Convert.ToBoolean(Eval("Alert1"))) %>'></asp:Label>
     <asp:Label ID="Label1" runat="server" Text="Did not create 7 meetings on monday." ForeColor="Red" Font-Bold="true" Width="300" Visible='<%# (Convert.ToBoolean(Eval("Alert2"))) %>'></asp:Label> 
        <table id="calendar">
        <tr>
        <td>
        </td>
        </tr>
        </table>
        </div>
        </ContentTemplate>
     <Triggers>                                                           
     <asp:AsyncPostBackTrigger ControlID="imgBtnPrevious" EventName="Click" /> 
     <asp:AsyncPostBackTrigger ControlID="imgBtnNext" EventName="Click" /> 
     </Triggers>
     </asp:UpdatePanel>
</td>
</tr>
</table>
 </ItemTemplate>
 </asp:TemplateField>
 </Columns>
 </asp:GridView>

Here I am updating the table calendar content with partial postback for button click event of imgBtnPrevious imgBtnNext which has some calendar like structure. This code is working fine for 1st 14 - 15 rows but this issue coming after that.

Note: there are other huge data in each row but here i have shown only the update panel structure for example.

UPDATE

I have investigated the issue further and disabled all update panels to check if update panel is causing issue but I found it not due update panel. The buttons click event is not firing after 14 -15 rows. even tried with row command and still same. what may be the root of this issue? any solution? please help. Whenever i click the button it just reload the page but click event is not hitting the debugger.

I found the issue. OnRowdataBound of grid view there was some code which was appending extra row in that table which was causing this strange issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM