Hi there,

I have an application with a large number of pages, often with forms, and on the master page I have a search box. When a user fills out a form, then presses enter, rather than submit the form, it submits the search.

Is there any way I can exclude the search button from the default button? I know I could go round each page and wrap a panel round each one and set the default button there, but there are a lot of pages so I'm trying to prevent that.

I'm using an ImageButton for the search, so it doesn't have the UsesSubmitBehaviour option, which was something else I thought might work.

Thanks

>and on the master page I have a search box.

Wrap search box content into a panel.

>and on the master page I have a search box.

Wrap search box content into a panel.

Right, I could've sworn I tried that and it didn't work, but I just tried again and it worked fine! Simpler solution than I was expecting - thanks very much...

You're welcome, glad I could help. Please mark this thread as solved.

Ok, it appears I spoke too soon about this problem being solved. After more thorough testing, it turned out the problem was still there.

I have tried various things now:

Added a Panel round the search control with no default button set.

Added panels round each of the itemtemplates within the formview, with the default button set to the Insert/Update button.

As a test, I've even added a dummy button next to the search box and set the ID of the dummy button as the DefaultButton, but with all of these, still it is the search submit button that is "pressed" on enter.

I've pretty much run out of ideas (and patience!). Does anyone have anything else I can try to stop the search being submitted when a user presses enter?

Thanks

Hi again.

I take it no one has any ideas about this problem? Thought I'd come back on and give it one last shot.

Any thoughts would be appreciated on this...

Thanks

This might be what you tried, but what I did , was I set the default button for the form, then I wrapped the search area in a panel and gave it its own default button. So, if you were in the search panel and pressed enter, it would trigger the search, but if you were anywhere else, it would trigger the page button.

I'm trying to prevent any buttons from getting triggered when the user presses enter. Haven't found a solution to that yet.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.