I have a textBox and I want to create a confirm message on text_changed event and execute different codes on ok and cancel in code behind under text_changed event
<asp:TextBox ID="TextBox1" runat="server" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
To achieve your functionality you have to do following
Make AutoPostBack="True" of your text box.
Add one hidden filed and add java script like following code example in aspx page.
Note: java script block must be come after you hidden field and text box control.
Now in server side put code check as following
window.confirm returns a boolean, in your button you could add
onclick="trigger_confirmation"
try this code inside your
TextBox1_TextChanged
block: