Hi makumbi,
Please refer below sample example.
HTML
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=txtData]').on('keypress', function () {
var number = $(this).val();
if (number.length == 2) {
$(this).val($(this).val() + '-');
}
});
});
</script>
<asp:TextBox runat="server" ID="txtData" MaxLength="5" />
Screenshot