In Asp.net,Just do the following code in Button click Event,,
if (textbox1.Text !="")
{
ScriptManager.RegisterClientScriptBlock(Page,typeof(Page),"ClientScript","alert('hello')",true);
}
else
{
ScriptManager.RegisterClientScriptBlock(Page,typeof(Page),"ClientScript","alert('Plz fill the textbox')",true);
}