Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
<td align="center">
                    No. of days
                        <asp:TextBox ID="txtNoDaysCandt" Columns="3" runat="server" CssClass="tabletext"   AutoPostBack="True" Text="5" MaxLength="3" OnDataBinding="SetContextKey()" ></asp:TextBox>
                </td>
 

<asp:TextBox ID="TextBox2" runat="server" OnDataBinding ="SetContextKey()"></asp:TextBox>
<cc1:AutoCompleteExtender ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"    CompletionInterval="100" EnableCaching="false" CompletionSetCount="10"
TargetControlID="TextBox2" UseContextKey = "true" ID="AutoCompleteExtender1"
runat="server" FirstRowSelected = "false" onclientitemover="SetSelectedValue">
</cc1:AutoCompleteExtender>
 

 

and vb code is...
<System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()> _
   Public Shared Function GetCompletionList1(ByVal prefixText As String, ByVal count As Integer, ByVal contextKey As String) As List(Of String)
       Dim n As String = contextKey
       Dim userid As String = HttpContext.Current.Session("LogIn_user")
       Dim constr As String = System.Web.Configuration.WebConfigurationManager.ConnectionStrings("DBConnectionString").ConnectionString
       Dim con As New SqlConnection(constr)
 
       Dim cmd As New SqlCommand("select first_name,last_name from Candidate where first_name like'%" & prefixText & "%'and recruiter_FK in (select row_id from dbo.appuser WHERE user_id='" + userid + "')", con)
       con.Open()
       Dim rd As SqlDataReader = cmd.ExecuteReader()
       Dim list As New List(Of String)()
       While rd.Read()
           list.Add(rd(0).ToString())
           'list.Add(rd(1).ToString())
       End While
       con.Close()
 
       Return list
   End Function
 
how can i get the value of no.of days textbox through contex key in auto complete extender or any other option to get value of it..
Posted 29-Oct-12 19:41pm
Comments
Sanjeev9918 at 30-Oct-12 0:43am
   
and the set context key() method is..
function SetContextKey() {
$find('<%=AutoCompleteExtender1>%').set_contextKey($get("<%=txtNoDaysCandt.ClientID%>").value);

}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 30 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100