ASP.Net: Unexpected form execution flow
Have a look at this page:
http://173.203.72.190:12123/Search-Results.aspx?Mode=Browse&Cuisine=-1&Zone=-1
If you click 'Browse' with the 'Any Cuisine', 'Any Zone' values, you will see results shown for all restaurants. If you put in a search string in the 'Search' box, you should see the results for that restaurant.
Here's where it gets strange - everything works perfectly when I click on the 'Go' or 'Search' button. However, if I just type a search query and hit return, then the page responds in a very unexpected way - it's like execution was interrupted, and the Search_Click functio开发者_高级运维n was not called!
Please note that both the Browse and Search controls/buttons are in separate panels, with their respective buttons set as the defaultButton. You can see this working perfectly on gulfdine.com.
Any clues on what might be going on?
Thanks, WT
Clicking on the 'Join Today' button has the same result of hitting return. Since it's the 1st submit button on the page, it's using it as the default button.
Try this...use the default button attribute on the panel that surrounds your Search controls.
<asp:Panel runat="server" id="searchPanel" DefaultButton="SearchButton">
<!--form here-->
</asp:Panel>
Now when the user's focus is in the panel and they click enter, the default button will get submitted.
Use the attribute on the other panels too.
Whoops! It was my mistake! I checked Firebug, and it showed that the page had some major errors. I realized that the URL rewriting from IIS 7 was redirecting the webresource.axd file!
精彩评论