A GridView will list rows which have to be approved/rejected. First column is named 'Action', which when clicked will display the ajax popupcontrolextender panel with two links (Approve/Reject). After the link is clicked, I need to update the status in the DB & refresh the GridView. ObjectDataSource is used to Bind the GridView. I have used the below code inside RowCommand event:
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()
HTML of the TemplateField 'Action':
<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>
Tried the below methods, but no success:
- Suppress the panel's visibility using style="display:'';"
- Called the Cancel() method of the PopupControlExtender
Note: The pop-up disappears if I don't bind the GridView inside the RowCommand event. But, I need to refresh the results displayed after Approve/Reject.
Appreciate any help. Thanks!