Tech Talk Live Blog

Post Back Not Executed When a Link in GridView in Popup Model Is Clicked

Thai Tran

THE PROBLEM: Post Back Not Executed When a Link in GridView in Popup Model Is Clicked.

The ModalPopup Extender that enhances the user experience was a necessary part in a project that I was working on at IU13. On the popup, there is a need to post back the page when a link in a row from the GridView is clicked to display a document from a third party GleamTech DocumentViewer control.

Usually, the post back is performed with a click event of the button in the modalpopupextender after that button ID is added in the <Triggers> section, but when I tried to put the link to that row in the grid into the <Triggers> section using the following code:

<cc1:modalpopupextender ID="mpLeaveManagementForm" runat="server"
PopupControlID="pnlLeaveManagementForm" TargetControlID="btnLeaveManagementFake"
CancelControlID="btnLeaveManagementClose" BackgroundCssClass="modalBackground">
<asp:UpdatePanel ID="pnlLeaveManagementChildForm" CssClass="modalPopup-inner" runat="server">
<asp:GridView ID="gvLeaveManagementDocuments" runat="server"
OnRowCommand="gvLeaveManagementDocuments_OnRowCommand" >
<asp:TemplateField HeaderText="Document Type" >
<asp:LinkButton ID="lnkShowLeaveDocument" runat="server"
CommandArgument='<%# Eval("LeaveDocumentID") %>'
CommandName="ShowLeaveDocument" Text='<%# Eval("DocTypeName")%>' />
<asp:TemplateField HeaderText="File Name">
<%# Eval("FileName") %></ItemTemplate>
<asp:PostBackTrigger ControlID="lnkShowLeaveDocument" />
</asp:UpdatePanel> <code>

The application threw this error:

System.InvalidOperationException: A control with ID ‘lnkShowLeaveDocument’ could not be found for the trigger in UpdatePanel ‘pnlLeaveManagementChildForm’


  1. Add an OnRowDataBound event in the <asp:GridView>

<asp:GridView ID="gvLeaveManagementDocuments" runat="server"

  1. Implement the handler in the code behind, and call the RegisterPostBackControl method for each LinkButton in the gridview:

protected void gvLeaveManagementDocuments_OnRowDataBound(object sender,
GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
LinkButton lb = e.Row.FindControl("lnkShowLeaveDocument") as LinkButton;

The RegisterPostBackControl method used to configure postback controls inside an UpdatePanel control that would otherwise perform asynchronous postbacks will update a whole page and include the third party GleamTech DocumentViewer control, instead of updating only the UpdatePanel control’s content.

Now, with each LinkButton registered in the OnRowDataBound event handler, if the user clicks on the link in the popup, the post back now is performed and the Document Viewer is displayed as expected.

Tech Talk Live Blog Comment Guidelines:

One of our main goals at Tech Talk Live is to build a community. It is our hope that this blog can be a forum for discussion around our content. We see commenting as an integral part of this community. It allows everyone to participate, contribute, connect, and share relevant personal experience that adds value to the conversation. Respect counts. We believe you can disagree without being disagreeable. Please refrain from personal attacks, name calling, libel/defamation, hate speech, discriminatory or obscene/profane language, etc. Comments should keep to the topic at hand, and not be promotional or commercial in nature. Please do not link to personal blog posts, websites, or social media accounts that are irrelevant to the conversation. This is considered self-promotion. We welcome links that help further the conversation and reserve the right to delete those we deem unnecessary. The appearance of external links on this site does not constitute official endorsement on behalf of Tech Talk Live or Lancaster-Lebanon Intermediate Unit 13. You are solely responsible for the content that you post – please use your best judgment. We reserve the right to remove posts that do not follow these guidelines.

Leave a Reply

Your email address will not be published. Required fields are marked *


Tech Talk Live is the only conference of its kind in the region specifically designed for IT pros in education.


1020 New Holland Avenue
Lancaster, PA 17601

(717) 606-1770