You should be find
ing the AutoCompleteExtender by its BehaviorID
, not ID
(BehaviorID
extends functionality of the DOM element returned, i.e. providing the set_contextKey
function). You're also missing a $
in front of the find
function.
<script type="text/javascript">
function setContextKey() {
$find('AutoCompBehavior2').set_contextKey($get("%=TxtSyllabus.ClientID%>").value)
alert(("<%=TxtSyllabus.ClientID %>").value)
}
script>
<asp:TextBox ID="TxtSem" runat="server" Width="200px" onkeyup="setContextKey()">asp:TextBox>
<asp:AutoCompleteExtender ID="AutoCompExt2" BehaviorID="AutoCompBehavior2" runat="server" MinimumPrefixLength="2" CompletionInterval="100" FirstRowSelected="false"
TargetControlID="TxtSem" EnableCaching="false" CompletionSetCount="10" ServiceMethod="SearchSem" UseContextKey="true">asp:AutoCompleteExtender>
Also, you probably meant to bind setContextKey
to changes to TxtSyllabus
, not txtSem
.
manpreet
Best Answer
2 years ago
Aspx code:
VB Code: