You should do this with JavaScript. This question shows us how to detect when the textbox value changes. This question tells us how to tell if the textbox is empty or not. This demo shows us how to hide and show things with jQuery.
Notice that I made the ClientIdMode="static"
for the controls, to avoid having different ID's on the client side than on the server. And instead of using the Visible property on the checkbox, I use the display: none
CSS. Visible="false"
would not even send the markup for the checkbox to the client, and we need that markup so we can show it without a postback.
<p>Telefon:<asp:TextBox ID="txtPhone" ClientIdMode="static" runat="server"></asp:TextBox></p>
<asp:CheckBox ID="CheckBox2" ClientIdMode="static" runat="server" Text="bla bla" style="display: none" />
$(function() {
$('#txtPhone').on('input propertychange paste', function() {
if($('#txtPhone').val()){
$("#CheckBox2").show();
}
else{
$("#CheckBox2").hide();
}
});
});
Telefon: