ASP.NET - Modalpopup extendar's Cancel control id

Asked By Rajasekhar Naidu on 09-Apr-12 05:25 AM
hello sir/mam,

  Modalpopup extendar's Cancel control id is linkbutton,but linkbutton placed in listview control,so modal popup is not to solve this
code is as follows:
 <cc1:ModalPopupExtender ID="mpeDoctorAppointment"   runat="server" CancelControlID="lbtndoctorpopupclose" PopupControlID="DoctorAppointments"
      TargetControlID="Label3" BackgroundCssClass="modalbackground">
    <asp:Label ID="Label3" runat="server" Text="Label" Style="display: none;"></asp:Label>

 <asp:ListView ID="LvDoctorAppointments" runat="server">
          <ul id="itemplaceholder" runat="server">
 <div class="autodiv paddingleft " style="padding-top: 11px">
                    <asp:LinkButton ID="lbtndoctorpopupclose" runat="server" CssClass="close" ></asp:LinkButton>

Jitendra Faye replied to Rajasekhar Naidu on 09-Apr-12 05:30 AM
Why you want to set CancelControlId= linkbutton id which is in ListView.

If you want like this then you can put ModalPopupExtender inside ListView only then it will work.

Somesh Yadav replied to Rajasekhar Naidu on 09-Apr-12 05:30 AM


<ajax:ModalPopupExtender runat="server" ID="modalPop" 
CancelControlID="btnCancel" X="470" Y="300"   />

protected void OkButton_Clicked(object sender, EventArgs e)

        //Do something in codebehind

And don't set the OK button as OkControlID.

Rajasekhar Naidu replied to Jitendra Faye on 09-Apr-12 05:42 AM
actually whole popup will be there in listview only ,if i put link button out of listview i will get css problems and as u told if i use extendar with in the listview can i use that extendar with id directly or i am supposed to find it in code behind
dipa ahuja replied to Rajasekhar Naidu on 09-Apr-12 07:04 AM
Here is the simple solution <cc1:ModalPopupExtender TargetControlID="Button3" BackgroundCssClass="modalBackground"
PopupControlID="Panel1" CancelControlID="lnkClose" PopupDragHandleControlID="btnMsg"
ID="ModalPopupExtender1" runat="server" />
<asp:Button ID="Button3" runat="server" Text="Take Input" />
<asp:Panel ID="Panel1" runat="server" Height="80" CssClass="ModalWindow">
<%--Take ListView here--%>
<asp:LinkButton ID="lnkClose" runat="server" Text="X" />