You can use customvalidator:
In .aspx:
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<asp:CustomValidator runat="server" ErrorMessage="Text must not be null or 0" ControlToValidate="txt1" OnServerValidate="TextBoxValidate" ForeColor="Red" />
<asp:TextBox ID="txt2" runat="server"></asp:TextBox>
<asp:CustomValidator runat="server" ErrorMessage="Text must not be null or 0" ControlToValidate="txt2" OnServerValidate="TextBoxValidate" ForeColor="Red" />
<asp:TextBox ID="txt3" runat="server"></asp:TextBox>
<asp:CustomValidator runat="server" ErrorMessage="Text must not be null or 0" ControlToValidate="txt3" OnServerValidate="TextBoxValidate" ForeColor="Red"/>
<asp:Button ID="btnDoSomething" runat="server" Text="Do something" OnClick="btnDoSomething_Click" />
In .cs:
protected void btnDoSomething_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
//Do something
}
protected void TextBoxValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = (args.Value != null && args.Value != "0");
}