Question

In Aspnet, how to trigger RequiredFieldValidator when a textbox is clicked?

Was it helpful?

Solution

<asp:TextBox ID="TextBox1" runat="server" onclick="javascript:trig();"></asp:TextBox>

javascript function

 function trig() {
        ValidatorEnable(document.getElementById('<%= ValidatorID.ClientID %>'), true);
    }

OTHER TIPS

In ajax control toolkit, there is a control called validator callout that will help you to do this, link here http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ValidatorCallout/ValidatorCallout.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top