Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6547075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:47:10+00:00 2026-05-25T11:47:10+00:00

I am trying set a button on a user control as defaultbutton on a

  • 0

I am trying set a button on a user control as defaultbutton on a page but its not working. Here is the code for my user control

<asp:Panel ID="pnlTopicPicker"  runat="server" DefaultButton="btnSubmit">
    <div class="PadBottom">
        <div id="divTopic" class="FloatLeft PadDiv">
            <div class="SectionHeader FloatLeft PadRightMediumSmall">Topic:</div>
            <asp:DropDownList ID="ddlSelectedTopic" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlSelectedTopic_OnSelectedIndexChanged" >
            </asp:DropDownList>
        </div>
        <div class="FloatLeft PadLeftMediumSmall">
               <asp:Button ID="btnClear" runat="server" Text="Clear" OnClick="btnClear_Click" CssClass="DefaultButton" />
        </div>
        <div class="FloatRight PadRightMediumSmall">
               <asp:Button ID="btnSubmit" runat="server" Text="View Report" OnClick="btnSubmit_Click" OnClientClick="return ViewReportSubmit(event);" CssClass="DefaultButton" />
        </div>
     </div>
</asp:Panel>

I am using the above control : TopicPicker in a page:

<asp:UpdatePanel ID="pnlFind" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
            <div class="PadLeft">
                <Incapnet:TopicPicker ID="incTopicPicker" runat="server" OnClearClick="btnClear_Click" OnSubmitClick="btnSubmit_Click" OnSelectedTopicChanged="ddlSelectedTopic_Changed" />
            </div>
            <div class="ClearBoth" />
            <div class="PadTop PadLeft" >
                <asp:GridView ID="gvFindGrid" runat="server" AutoGenerateColumns="False" OnRowDataBound="gvFindGrid_RowDataBound" 
                         CssClass="ContrastTable UFWideTable"  GridLines="None">
                    <AlternatingRowStyle CssClass="AlternateRow" />
                    <RowStyle CssClass="Row" />
                    <HeaderStyle CssClass="HeaderRow" />
                    <EmptyDataTemplate>
                        No Records Found
                    </EmptyDataTemplate>
                    <Columns>
                    ... 
                    ...
        </ContentTemplate>
    </asp:UpdatePanel>

Now when I hit enter, on the page, I want the “btnSubmit” to be executed, which is not happening.

How do I get this working.

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:47:10+00:00Added an answer on May 25, 2026 at 11:47 am

    under what circumstances are you expecting the btnSubmit Click event to fire?

    I ask because the event will only be triggered if the Enter key is pressed when a control which implements the IButtonControl interface has focus.

    This would include (among others) TextBox and DropDownList.

    If you select your DropDownList and then hit enter it should fire the event. But just clicking any element (such as a DIV) and hitting enter would not.


    Edit (Based on comment)

    Its a bit of a hack but you can achieve what you ask using the following javascript (uses JQuery):

    <script type="text/javascript">
        $(document).keypress(function (e) {
            var code = (e.keyCode ? e.keyCode : e.which);
            if (code == 13) {
                $('#<%= btnSubmit.ClientID %>').click();
            }
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to set textColor property of button in android 2.1. But I
I am trying to set a ViewState-variable when a button is pressed, but it
I'm trying to develop a custom tri-state button user control and so far I've
I am trying to set up an add-tab button in a Gtk::Notebook (gtkmm). I
I am trying to set the click event of a button on my form
I trying to set separate style for particular widgets, like for one button with
I am trying to design a set of icons in a Silverlight 4 User
I'm trying to write a user control that has an ItemsControl, the ItemsTemplate of
I'm trying to do something that sounds fairly simple using ASP.NET 3.5. A user
I am trying to set the selected folder in a FolderBrowserDialog control as a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.