Jump to content

DropDownlist Not showing any data

Recommended Posts

I am trying to assign data to dropdownlist in asp.net from textbox Textchanged event but dropdownlist not showing any data . actually i am trying to connect with database asynchronously so that i must able to see suggestions just like google instant related with whatever i am enetering in textbox but i can't get it.


any help will be appreciated.


vb.net code



Protected Sub tXtCustomer_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles tXtCustomer.TextChanged
Dim strsql4 As New StringBuilder
Dim localdt4 As New DataTable
With strsql4
.Append("select mc.ccncd,mp.partycd from mccn mc inner join mparty mp on mc.PartyCd=mp.partycd where mp.PartyCd like '" & tXtCustomer.Text & "%' ")
End With
localdt4 = CommonDb.ReturnDataTable(strsql4.ToString, "ERP")
If localdt4.Rows.Count > 0 Then
drpCcnTrial.DataSource = localdt4
drpCcnTrial.DataTextField = "ccncd"
drpCcnTrial.DataValueField = "ccncd"
drpCcnTrial.Items.Insert(0, New ListItem("Select CCN from List", 0))
End If
End Sub
asp.net code
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server">
<asp:AsyncPostBackTrigger ControlID="txtCustomer" EventName="TextChanged" />
<asp:TextBox ID="tXtCustomer" runat="server" autopostback="true" ></asp:TextBox>
<asp:DropDownList ID="drpCustomer" runat="server">
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...