So I want a Button1 to be clicked when the submit button has been clicked.
Here is the relevant code:
<input id="Submit1" type="submit" value="Search" onclick="javascript:check_user()" />
<script type="text/javascript">
function check_user() {
document.getElementById('<%=Button1.ClientID%>').click();
}
</script>
<asp:Button id="Button1" runat="server" Visible="false" OnClick="Button1_Click"/>
And here is the error I get:
Microsoft JScript runtime error: Unable to get value of the property ‘click’: object is null or undefined
Does anyone have any ideas as to what the problem might be? I’ve been tearing my hair out trying to work it out.
Can’t you just do it with a single button?
Server-side code: