Click here to Skip to main content
16,011,974 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:
C#
<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
C#
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);
        }
    }
Posted
Updated 1-Feb-12 7:53am
v2

1 solution

The first thing I notice is that your linkbutton is not inside your modalpopupextender. Doesn't it need to be ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900