Click here to Skip to main content
15,909,051 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
ASP.NET
<asp:Panel ID="pnl_BeneficaryDetails" runat="server">
 <asp:Panel ID="pnl_BeneGrid" runat="server">
    <asp:ImageButton runat="server" ID="btn_Process" OnClick="btn_Process_Click" Visible="false" ImageUrl="~/image/process.png" ToolTip="Process Payment" />


What I have tried:

by using the above i want, when am click enter imagebutton shuld fired, but its not working, and when i am using the same in single panel then its working..
Posted
Updated 15-Nov-16 21:52pm
v5
Comments
kumarravishankar 15-Nov-16 5:58am    
by using the above i want, when am click enter imagebutton shuld fired, but its not working, and when i am using the same in single panel then its working..

For DefaultButton of Panel to work you have to have the Panel in focus... In your code the Panel in focus is the first (as it comes first...) and it has no DefaultButton whatsoever...
If you want the button be a global default, use DefaultButton property of the form...
 
Share this answer
 
Comments
kumarravishankar 15-Nov-16 6:07am    
m not getting so can u please explain more
Kornfeld Eliyahu Peter 15-Nov-16 6:11am    
You have two panels - one with default button attached and one without...
As long as the panel with the default button attached NOT in focus the DefaultButton property is meaningless. The reason is that it is a private definition to that specific panel, but key events are bubbling from the focused element up to the form level...
In your code the panel in focus is the first one so any key event hits it first, than goes up to the form and never hits the second panel...
kumarravishankar 16-Nov-16 0:48am    
still m not getting any solution so can u plz give some demoo code for this ??
Add a default button to the parent panel.


ASP.NET
<asp:Panel ID="someOuterPanel" runat="server" DefaultButton="btn_Process">
   <asp:TextBox id="someTextBoxOutsideInnerButtonPanel" runat="server" />
      ... other buttons and stuff...
   <asp:Panel ID="pnl_BeneficaryDetails" runat="server" DefaultButton="btn_Process" > 
         <asp:ImageButton runat="server" ID="btn_Process" OnClick="btn_Process_Click" Visible="false" ImageUrl="~/image/process.png" ToolTip="Process Payment" />
 
Share this answer
 
v2
Comments
kumarravishankar 16-Nov-16 0:47am    
DefaultButton="btn_Process" , this code is not working here , I have already use this soution on other page which working fine , but not working in this code because nested panel is used here ..
haisol 16-Nov-16 8:43am    
You probably do not need the DefaultButton on the pnl_BeneficaryDetails since it's on the outer panel (someOuterPanel)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900