Jump to content

DropDownlist Not showing any data


rhishi20

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.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>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...