rhishi20 2 Posted July 20, 2015 Report Share Posted July 20, 2015 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.DataBind() 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"> <Triggers> <asp:AsyncPostBackTrigger ControlID="txtCustomer" EventName="TextChanged" /> </Triggers> <ContentTemplate> <asp:TextBox ID="tXtCustomer" runat="server" autopostback="true" ></asp:TextBox> <asp:DropDownList ID="drpCustomer" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel> Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.