开发者

ModalPopupExtender not working correctly

ModalPopupExtender control is not working correctly. The problem is, while click on the popup "OK" button, the code behind the "OK" button is not working. Please guide me to resolve the problem. Please see the code below,

        <ATK:ModalPopupExtender
            BackgroundCssClass="ModalPopupBG"
            DropShadow="true"
            OkControlID="btnDone"                
            CancelControlID="btnCancel"
            runat="server"
            PopupControlID="AddTopic"
            id="ModalPopupExtender1"                                                          
            TargetControlID="btnAddNew"/> 

    <asp:Panel ID="AddTopic" runat="server"  CssClass="popup_Container"  >           
        <div class="popup_Titlebar" id="PopupHeader">
            <div class="TitlebarLeft">
                Add New Topic
            </div>
            <div c开发者_运维技巧lass="TitlebarRight" onclick="cancel();">
            </div>
        </div> 
        <div class="popup_Body">                                    
            <asp:Label ID="lblTopic" runat="server" Text="Topic Name"> </asp:Label>
            <asp:TextBox ID="tbTopicName" runat="server" Width="400px" ></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ErrorMessage="*" ControlToValidate="tbTopicName">
            </asp:RequiredFieldValidator>
            <br /> <br />  
            <span style="padding-left:350px">
                <asp:Button ID="btnDone" runat="server" Text="Ok" onclick="btnDone_Click"/> 
                <input id="btnCancel" value="Cancel" type="button" OnClick="cancel();" />                      
            </span>                
        </div>                 
    </asp:Panel>  

Finally, I resolved "OK" button not firing issue by remove the OkControlID property. But, now after execute the "OK" click event the popup window will close and immediately again show the original size of the popup window, and again closing. How to resolve this issue. please guide me.


Since You have use RequiredFieldValidator, so these are on when you click OK button, You have to Set CausesValidation="false" or use use ValidationGroup


If you really need validation in modal popup use javascript / jquery .

Check this . http://usefulaspnet.blogspot.com/2007/03/modal-popup-with-textbox-and-validator.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜