button within formview won't launch ajax modalpopup

ud2008

Well-known member
Joined
Jul 5, 2010
Messages
148
Programming Experience
Beginner
I have a formview, inside it there is a button, which should launch an ajax modalpopup.
But when I run the page, I get the following message:

"The TargetControlID of 'ModalPopupExtender1' is not valid. A control with ID 'OpenPopup' could not be found."

The ID of the button within the formview is OpenPopup.

When I move the button outside the formview, everything works, but I want the button within the formview.

The code I have is as followed:
VB.NET:
<asp:scriptmanager id="ScriptManager1" runat="server">
    </asp:scriptmanager>
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="ModalPopupExtender1"
                        cancelcontrolid="btnCancel" okcontrolid="btnOkay" 
	                    targetcontrolid="OpenPopup" popupcontrolid="Panel1" 
	                    popupdraghandlecontrolid="PopupHeader" drag="true" 
	                    backgroundcssclass="ModalPopupBG">
                    </asp:ModalPopupExtender>
                    <asp:panel id="Panel1" style="display: none" runat="server">
	                    <div class="popup_Container">
                            <div class="popup_Titlebar" id="PopupHeader">
                                <div class="TitlebarLeft">Evenement toevoegen</div>
                                <div class="TitlebarRight" onclick="$get('btnCancel').click();"></div>
                            </div>
                            <div class="popup_Body">
                                   Hier is het mogelijk om nieuwe evenementen aanmaken.<br />
                                   Voer de naam van het evenement in, zoals hier: ScarWars2010.<br />
                                   Vergeet niet het jaartal erachter te plaatsen.<br />
                                   <br />
                                   <asp:Label ID="Label1" runat="server" Text="Naam Evenement:"></asp:Label><br />
                                   <asp:TextBox ID="Events1" runat="server"></asp:TextBox><br /><br />
                                   <asp:Label ID="Label2" runat="server" Text="Database naam:"></asp:Label><br />
                                   <asp:TextBox ID="Events2" runat="server" ReadOnly="true"></asp:TextBox><br />
                                   <asp:Button ID="Toevoegen1" runat="server" Text="Toevoegen" OnClick="GreetingBtn_Click" />
                            </div>
                            <div class="popup_Buttons">
                                <input id="btnOkay" type="button" value="Gereed" />
                                <input id="btnCancel" type="button" value="Annuleren" />
		                    </div>
                        </div>
                    </asp:panel>
    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"
        CellPadding="4" ForeColor="#333333" DataKeyNames="ID" CellSpacing="0">
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <EditItemTemplate>
        <table width="1150px" cellspacing="0" style="background-color:#5D7B9D; color:White">
                <tr>
                   <td><asp:Button ID="OpenPopup" runat="server" Text="Nieuwe Evenementen" /></td>
                </tr>
         </EditItemTemplate>
    </asp:FormView>

Can anyone help me?

Thanks
 
Back
Top