?
Solved

Enter key press # 2

Posted on 2012-09-10
8
Medium Priority
?
618 Views
Last Modified: 2012-09-27
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_27859660.html

When an info if not found, I use Panel and Modal to display message, like below. When I press Enter , why the panel is not close?


<asp:Panel ID="MyplePanel" runat="server" DefaultButton="btnCloseWindow">

<asp:Button ID="btnCloseWindow" runat="server" Text="Close" onclick="CloseWindow"/>
</asp:Panel>

protected Sub CloseWindow
      modalmsg.hide()

end sub
0
Comment
Question by:VBdotnet2005
  • 5
  • 2
8 Comments
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 38385880
I'm not an ASP expert  but I don't seem to see anything relating to a enter key being pressed.  OK, you have specified a default button but does any other control have the focus when you press the enter key.  (Try using the tab key to move then press enter - maybe after a few times of tab followed by enter it does do what you want).
0
 
LVL 35

Expert Comment

by:YZlat
ID: 38386662
There is no code that handles pressing Enter key, just as AndyAinscow pointed out.

You'll need to add a client-side script that captures the onKeyPress event and checks for
the ENTER key in particular
0
 
LVL 35

Expert Comment

by:YZlat
ID: 38386674
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Expert Comment

by:YZlat
ID: 38386701
Are you trying to call client-side function on click of a button?
0
 
LVL 35

Expert Comment

by:YZlat
ID: 38386716
if you want your button to work with panel, you will need server-side code:

Protected Sub CloseWindow(ByVal sender As Object, ByVal e As EventArgs)
   ''your code goes here
End Sub
0
 

Author Comment

by:VBdotnet2005
ID: 38387492
This is what I have. When press enter key, it does still does not work. What am I missing?

   <cc1:ModalPopupExtender ID="ModalGeneralmsg" runat="server" TargetControlID="lbtncancel"
        BehaviorID="ModalGeneralmsg" PopupControlID="PanelGeneralMessages" BackgroundCssClass="modalBackground"
        DropShadow="false" />


   <asp:Panel ID="PanelGeneralMessages" Width="400" CssClass="modalPopup" BackColor="#ececeb" DefaultButton="btnCloseWindow_redirect"
        Style="display: none" GroupingText="" runat="server" >
        <center>
            <asp:UpdatePanel ID="UpdatePanelGeneralMessages" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                   
                      <b><asp:Label ID="lbldisplay_transno" runat="server" Text=""></asp:Label></b>
                 
                    <asp:Button ID="btnCloseWindow_redirect" runat="server" Visible="true" OnClick="CloseWindow_redirect"
                        Text="Close" />
                   
                   
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </center>
    </asp:Panel>


 Protected Sub CloseWindow_redirect(ByVal sender As Object, ByVal e As EventArgs)
        ModalGeneralmsg.Hide()
        Response.Redirect("test.aspx")
    End Sub
0
 
LVL 35

Expert Comment

by:YZlat
ID: 38387608
What happens when you hit enter?
0
 

Author Comment

by:VBdotnet2005
ID: 38387634
Nothing happened at all.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question