GridView将列出必须被批准/拒绝的行。第一列命名为' Action',点击后会显示带有两个链接的ajax popupcontrolextender面板(批准/拒绝)。点击链接后,我需要更新数据库和数据库中的状态。刷新GridView。 ObjectDataSource用于绑定GridView。我在RowCommand事件中使用了以下代码:
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim gvRow As GridViewRow = GridView1.Rows(index)
If e.CommandName = "Approve" Then
BusinessLogicLayer.UpdateFileStatus(sID, Approve)
ElseIf e.CommandName = "Reject" Then
BusinessLogicLayer.UpdateFileStatus(sID, Reject)
End If
GridView1.DataBind()
DirectCast(gvRow.FindControl("pceMenu"), AjaxControlToolkit.PopupControlExtender).Cancel()
TemplateField的HTML'动作':
<asp:TemplateField HeaderText="Action" >
<ItemTemplate>
<ajax:PopupControlExtender ID="pceMenu" runat="server" TargetControlID="imgMenu" PopupControlID="pnlMenu" Position="Right" >
</ajax:PopupControlExtender>
<asp:Image ID="imgMenu" runat="server" ImageUrl="~/Images/gear.png" CssClass="popupImage" />
<asp:Panel ID="pnlMenu" runat="server" CssClass="popupControl" Width="85px" Height="50px" style="display:none;">
<div class="menu-row" style="border-top: none;">
<asp:Image ID="imgApprove" runat="server" ImageUrl="~/Images/tick.png" style="float:left;"/>
<asp:LinkButton ID="lnkApprove" runat="server" Text="Approve" ToolTip="Approve" style="margin-left:10px;" CommandName="Approve" />
</div>
<div class="menu-row">
<asp:Image ID="imgReject" runat="server" ImageUrl="~/Images/delete16.png" style="float:left;"/>
<asp:LinkButton ID="lnkReject" runat="server" Text="Reject" ToolTip="Reject" style="margin-left:10px;" CommandName="Reject" />
</div>
</asp:Panel>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left"/>
<ItemStyle HorizontalAlign="Center" Width="5%"/>
</asp:TemplateField>
尝试了以下方法,但没有成功:
注意:如果我没有在RowCommand事件中绑定GridView,弹出窗口就会消失。但是,我需要刷新批准/拒绝后显示的结果。
感谢任何帮助。谢谢!
答案 0 :(得分:0)
您好,您可以隐藏代码中的ajax control toolkit's modal popup extender,请尝试以下代码:
IdOfYourModelPopup.Hide();