title: Ajax AutoComplete Extender with contextKey
body: <p>Aspx code:</p>
  
  <pre><code>&lt;script type ="text/javascript"&gt;
      function setContextKey() {
          find('AutoCompExt2').set_contextKey($get("%=TxtSyllabus.ClientID%&gt;").value)
          alert(("&lt;%=TxtSyllabus.ClientID %&gt;").value)
          }
  &lt;/script&gt;
  &lt;asp:TextBox ID = "TxtSem" runat = "server" Width = "200px" onkeyup="setContextKey()"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:AutoCompleteExtender ID = "AutoCompExt2" runat = "server" MinimumPrefixLength="2" CompletionInterval="100" FirstRowSelected = "false"
          TargetControlID= "TxtSem" EnableCaching = "false" CompletionSetCount = "10" ServiceMethod = "SearchSem" UseContextKey= "true" &gt;&lt;/asp:AutoCompleteExtender&gt;`
  </code></pre>
  
  <p>VB Code:</p>
  
  <pre><code>&lt;System.Web.Script.Services.ScriptMethod(), System.Web.Services.WebMethod()&gt; _
  Public Shared Function SearchSem(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As List(Of String)
      Try
          Dim cnn As New SqlConnection
          Dim cmd As New SqlCommand
          Dim ds As New Data.DataSet
          Dim SyllabusName = Mid(contextKey, 1, Len(contextKey) - 4)
          Dim Year = Mid(contextKey, Len(contextKey) - 4, Len(contextKey))
  
  
          cnn.ConnectionString = ConfigurationManager.ConnectionStrings("excelconn").ToString()
          cmd.CommandText = "Select Semester From MastLookup where SyllabusName='" &amp; SyllabusName &amp; "' And SyllabusYear='" &amp; Year &amp; "' And Semester=@SearchText + '%'"
          cmd.Parameters.AddWithValue("SearchText", prefixText)
          cmd.CommandType = Data.CommandType.Text
          cmd.Connection = cnn
          cnn.Open()
  
          Dim Syllabus As List(Of String) = New List(Of String)
          Dim sdr As SqlDataReader = cmd.ExecuteReader
          While sdr.Read
              Syllabus.Add(sdr("Semester").ToString)
          End While
          cnn.Close()
          Return Syllabus
          cnn.Close()
      Catch ex As Exception
  
      End Try
  End Function`
  </code></pre>
  
  <p>Error:
  I am getting null value of ContextKey and even Alertbox is not appeared.</p>