Try this:
the aspx markup for button
<asp:TextBox ID="TextBox1" runat="server" onkeypress="return checkSpace(this);" Width="485px" MaxLength="58"></asp:TextBox>
and the javaScript to achieve what you want
function checkSpace(sender)
{
var data = sender.value;
if(data.length == 25 && data.substring(25,26) != ' ')
{
alert('please enter space now');
return false;
}
}
I tested it on my end and it is working fine. Let me know if it works on your end too. if not I will try to refine my answer.