There is a
TextBox1_TextChanged
event for this.
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
}
This will let the page post back and the code will be executed on the server.
If you do not need server side processing, using JavaScript is recommended.
You can add an
onblur
event to the textbox and call a JavaScript function to do the required validation.
<asp:TextBox ID="TextBox1" runat="server" onblur="return ValidateDDL();"></asp:TextBox>
function ValidateDDL()
{
if(document.getElementById("<%= DropDownList1.ClientID %>").value == document.getElementById("<%= TextBox1.ClientID %>").value)
{
alert("cannot be duplicate");
return false;
}
return true;
}
Hope this helps!