C# .NET - link button inside the grid view not firing when used with modal popup

Asked By abinav shankar on 01-Feb-12 10:58 AM
Hi
 
I have used a modal popup extender for a link button which is inside the gridview now when i click the link button i get the modal popup but the link button event is not getting fired how can it be done pl refer my code and tell me
modal popup extender:
<asp:TemplateField HeaderText="Reject">
              <ItemTemplate>
                <asp:LinkButton ID="lnkReject" runat="server" onclick="lnkReject_Click">Reject</asp:LinkButton>
                <cc1:ModalPopupExtender ID="ModalPopupExtender1"  CancelControlID="btnCancel"  runat="server" TargetControlID="lnkReject" 
                PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader" >
                </cc1:ModalPopupExtender>
              </ItemTemplate>
            </asp:TemplateField>

Event which should be fired

protected void lnkReject_Click(object sender, EventArgs e)
  {
    try
    {
      LinkButton lnkReject = (LinkButton)sender;
      GridViewRow gvRowApprove = (GridViewRow)lnkReject.NamingContainer;
      LinkButton lnkAssid = (LinkButton)gvRowApprove.FindControl("lnkAssId");
      Label lblleaveType = (Label)gvRowApprove.FindControl("lblLeaveType");
      int leaveId = objApproveOrReject.getLeaveReqId(lnkAssid.Text.Trim(), "pending", lblleaveType.Text);
      Session["LeaveType"] = lblleaveType.Text;
      Session["leaveId"] = leaveId;
      string url = "lms_Rejection.aspx";
      ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "openPopup", "window.open('" + url + "','_blank','height=400,width=400,status=yes,toolbar=no,menubar=no,location=yes,scrollbars=yes,resizable=no,titlebar=no' );", true);
    }
    catch (Exception ex)
    {
      throw (ex);
    }
  }
.

dipa ahuja replied to abinav shankar on 01-Feb-12 11:19 AM
I think this is because you have created the click event of the linkbutton and assing it as the TargetPopupID of modalpopup.

You have two options to solve, remove the linkButton click OR add the ModalPopupExtender.Show(); statement at the end of linkButton Click event