views:

1272

answers:

2

Hi, Wwhen I click the button on the popup to insert data to database, it does nothing, WHYYYYY?

<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="popup" TargetControlID="cmdTrigger" 
            PopupControlID="pnlPopup" BackgroundCssClass="modalBackground"
            OkControlID="btnOk" >
    </cc1:ModalPopupExtender>  
    <asp:Panel ID="pnlPopup" runat="server" CssClass="modalpopup" Style="display: none">
        <div class="container">
            <div class="header">
                <asp:Label ID="Label1" runat="server" CssClass="msg" Text="Add a new Entry" />
                <asp:LinkButton ID="LinkButton1" runat="server" CssClass="close" OnClientClick="$find('popup').hide(); return false;" />
            </div>
            <div class="body">
                <asp:Label ID="Label2" runat="server" CssClass="msg" Text="Name" />
                <asp:TextBox ID="txtName" runat="server" Width="346px"></asp:TextBox>
                </div>
            <div class="footer">
                <asp:Button ID="btnOk" runat="server" Text="Save" Width="48px"   />
                <asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="50px" OnClientClick="$find('popup').hide(); return false;" />
            </div>
        </div>
    </asp:Panel>

The code on the btnOK is

a simple textbox1.text = txtName

I even tries setting a breakpoint, the button click event is not being executed. Any ideas?

Edit ~ Solution

Follow http://forums.asp.net/t/1070213.aspx

+1  A: 

Remove the OkControlId property as I think it prevents a postback from occuring.

Robert Wagner
I tried this but didn't work <asp:Button ID="btnOk" runat="server" Text="Save" Width="48px" CausesValidation="false" OnClick="AddEntry" />
Saif Khan
I have some validation controls on this form. Couls this be causing the issue?
Saif Khan
Public Sub AddEntry(ByVal sender As Object, ByVal e As EventArgs) MsgBox("TEST") End Sub
Saif Khan
A: 

Remove CausesValidation="false" either make it true. It will work

Cheers :) Ashish