hitting enter does not submit form but refreshes page?

A

Abraham Luna

i am using a master and content page
the regular aspx page not attached to a master page will submit when the
user hits enter

how come a content page will not submit if the user hits enter?
 
B

Brock Allen

You need to use the <form defaultbutton="IDOfAButton"> or the HtmlForm.DefaultButton
property.
 
A

Abraham Luna

thank you for your answer brock.

i set the defaultbutton in the page_load event. i get an error:

The DefaultButton of '' must be the ID of a control of type IButtonControl.

i think it's because i use a usercontrol:

<RDK:RDK_BaseButton ID="btnSearch" Text="Search" runat="server"
OnClick="btnSearch_Click" />

what can i do to get .net to recognize that it is really a button?

thank you.
 
B

Brock Allen

You need the ID of the Button inside your custom control. The UniqueID property
is the string you want to use when the Button is nested inside other controls.
 
M

Marius

I have the same scenario where I have a user control that contains an image
button in ASP.Net 2.0 beta 2. Setting the 'DefaultButton' of a panel or form
to the unique ID of the image button within the user control does not work
for me. I keep getting the message about the control has to implement
iButtonControl.

Do you have any further information to assist in this matter?
 
A

Abraham Andres Luna

finally got it to work:

if (!IsPostBack)
{
this.Form.DefaultButton = btnSearch.UniqueID;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top