简体   繁体   English

当在网格视图内的更新面板内时,Asp 图像按钮单击事件不会为所有行触发

[英]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.此部分回发适用于前几行,但在几行之后,可以说大约 15 行按钮单击事件未命中,只有断点进入页面加载事件和整个页面刷新。

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.在这里,我使用部分回发更新表日历内容,用于 imgBtnPrevious imgBtnNext 的按钮单击事件,该事件具有类似日历的结构。 This code is working fine for 1st 14 - 15 rows but this issue coming after that.此代码适用于第 14 - 15 行,但此问题随后出现。

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.按钮单击事件在 14 -15 行后未触发。 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.网格视图的 OnRowdataBound 有一些代码在该表中附加了额外的行,这导致了这个奇怪的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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