Click here to Skip to main content
15,891,903 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Protected Sub GetDeviceTypeDDL()
Try
cmd.Connection = con
cmd.CommandText = "SELECT [DEVCODE], [DEVDESC] FROM [TBL_DEVICETYPE_COD]"
cmd.Connection.Open()
dr = cmd.ExecuteReader()
'ddlSignatory.Items.Add("")
While dr.Read()
Dim newListItem As New ListItem()
newListItem.Text = dr.GetString(0).ToString()
newListItem.Value = dr.GetValue(1).ToString()
ddlDeviceType.Items.Add(newListItem)
End While
cmd.Connection.Close()
Catch ex As Exception
ddlDeviceType.Items.Add("")
cmd.Connection.Close()
End Try
End Sub
Protected Sub GetDeviceTypeDetails()

Dim da As New SqlDataAdapter("SELECT [DEVCODE], [DEVDESC] FROM [TBL_DEVICETYPE_COD]", strcon)
Dim dt As New Data.DataTable
da.Fill(dt)
da.Dispose()
ddlDeviceType.DataSource = dt
ddlDeviceType.DataTextField = "DEVDESC"
ddlDeviceType.DataValueField = "DEVCODE"
ddlDeviceType.DataBind()
'ddlcmp.ClearSelection()
End Sub
Posted
Comments
Rockstar_ 5-Jun-13 2:09am    
Ur question is not clear, plz elaborate?
akhil.krish 5-Jun-13 2:16am    
select the value not store in database... is store table 1st column default value is taking....
Rockstar_ 5-Jun-13 2:49am    
Soory dear, can't understand...
bluesathish 11-Jun-13 8:15am    
post your selected index change event code. Then only we can identify the issue.
Surendra Adhikari SA 12-Jun-13 7:33am    
you have to post your data insert code and selected index change event code of your drop down list.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900