Using OnClientClick with Chrome causes server side submit to fail.
<asp:Button id="btnSearch" runat="server" Text="Search" onclick="btnSearch_Click" OnClientClick="javascript:pageSubmit()" />
<script language="javascript">
function pageSubmit() {
var SearchForm = document.forms[0];
SearchForm.target = ‘_top’;
SearchForm.submit();
}
</script>
However, btnSearch_click doesn’t fire when running under google Chrome …
This is a bit of a hack that I’ve used to get round this:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack && string.IsNullOrEmpty(Request.Form["__EVENTTARGET"]))
{
btnSearch_Click(sender, e);
}
}
No marks for elegance, but it seems to work in Chrome, IE and Firefox.
}