I have a form with a text box: wherever value changed by typing, showing alert message by KeyPress event, but it does not work if "Use AutoComplete for Form" is enable in IE and then whenever user double click and select text from a list of "possible entries, user have typed before".
Asked
Active
Viewed 1,601 times
3 Answers
1
Use the client-side “onpropertychange” event for this purpose:
Here is the solution for both the standard and DevExpress (it looks like you are using it) textboxes:
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
//DevExpress ASPxTextBox
function OnInit(s, e) {
var inputElement = s.GetInputElement();
ASPxClientUtils.AttachEventToElement(inputElement, "propertychange", function (event) {
if (event.propertyName === "value") {
alert("Value Changed");
alert(event.srcElement.value);
}
});
}
//Standard Input
$(document).ready(function () {
var inputElement = document.getElementById("txt");
//var inputElement = document.getElementById('<%=txt.ClientID%>');
inputElement.attachEvent("onpropertychange", function (event) {
if (event.propertyName === "value") {
alert("Value Changed");
alert(event.srcElement.value);
}
});
});
</script>
<dx:ASPxTextBox ID="txtDX" runat="server" Width="170px">
<ClientSideEvents Init="OnInit" />
</dx:ASPxTextBox>
<br />
<input id="txt" type="text" runat="server" />
<br />
<asp:Button ID="btn" runat="server" Text="Button" />

Mikhail
- 9,186
- 4
- 33
- 49
0
U want some thing like this.see
http://jqueryui.com/demos/autocomplete/

4b0
- 21,981
- 30
- 95
- 142
-
Hey, i don't want auto-complete, I just want to handle an event when user select values from a list shown by browser. – Jeevan Bhatt Jan 12 '12 at 11:51