Your code should look like this
SignUp.aspx
<asp:TextBox ID="txtSur" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Invalid Surname" Enabled="True" ControlToValidate="txtSur" ForeColor="Red" ValidationExpression="\b[A-Za-z0-9]+\b" Display="Dynamic" SetFocusOnError="True">
<asp:Button ID="SignUpButton"
runat="server" Text="Sign Up" onclick="SignUpButton_Click" />
In SignUp.aspx.cs
protected void SignUpButton_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
}
}