我有一个带有手风琴控制的页面,其中我有2个网格放在两个框架中。我在网格中提供了验证以插入新行。
但是当我点击一个网格的更新时,两个网格都会得到验证。为了避免这种情况,我将此网格保留在更新面板中,我将更新按钮保留在触发器中,如下面的代码所示。但它在运行应用程序时抛出错误。
错误::: ID为' btnAdd'无法找到触发器 UpdatePanel' UpdatePanel3'
<asp:UpdatePanel ID="UpdatePanel3"
UpdateMode="Conditional"
runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnAdd" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="gvw_Authority" DataKeyNames="ID" runat="server"
AutoGenerateColumns="false" CssClass="Gridview" HeaderStyle-BackColor="#61A6F8"
ShowFooter="true" HeaderStyle-Font-Bold="true" HeaderStyle-ForeColor="White"
OnRowCancelingEdit="gvw_RowCancelingEdit"
OnRowDeleting="gvw_RowDeleting" OnRowEditing="gvw_RowEditing"
OnRowCommand="gvw_RowCommand">
<Columns>
....
<asp:TemplateField>
<EditItemTemplate>
<asp:ImageButton ID="imgbtnUpdate" runat="server" CommandName="Update" ImageUrl="~/Images/accent.png" ToolTip="Update" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnCancel" runat="server" CommandName="Cancel" ImageUrl="~/Images/bullet.png" ToolTip="Cancel" Height="20px" Width="20px" />
</EditItemTemplate>
<ItemTemplate>
<asp:ImageButton ID="imgbtnEdit" CommandName="Edit" runat="server" ImageUrl="~/Images/heroAccent.png" ToolTip="Edit" Height="20px" Width="20px" />
<asp:ImageButton ID="imgbtnDelete" CommandName="Delete" Text="Edit" runat="server" ImageUrl="~/Images/orderedList0.png" ToolTip="Delete" Height="20px" Width="20px" />
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="btnAdd" runat="server" ImageUrl="~/Images/orderedlList1.png" CommandName="AddNew" Width="30px" Height="30px" ToolTip="Add new User" ValidationGroup="validaiton1"></asp:LinkButton>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
请建议另一种解决方案,仅用于更新此网格。
提前致谢。
答案 0 :(得分:0)
我自己找到了解决方案。请在下面找到它。我们必须在链接按钮周围保留其他更新面板。
<FooterTemplate>
<asp:UpdatePanel ID="UpdatePanel3"
UpdateMode="Conditional"
runat="server">
<ContentTemplate>
<asp:LinkButton ID="btnAdd" runat="server" Text="Add" CommandName="AddNew" Width="30px" Height="30px" ToolTip="Add new User" ValidationGroup="validaiton1"></asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</FooterTemplate>