Dim zonename As String = DropDownList1.SelectedItem.Text
It always display the first value from the dropdownlist
Dim zonename As String = DropDownList1.SelectedItem.Text
It always display the first value from the dropdownlist
try it binding in is not postback
Reference
If you bind inside page load you will always get the first value of the dropdown list.
private void Page_Load()
{
if (!IsPostBack)
{
//bind your dropdown here
}
}
In VB
Sub Page_Load
If Not IsPostBack
' bind your dropdown list
Validate()
End If
End Sub
Storing Connection string you can use web.config file
http://www.connectionstrings.com/Articles/Show/store-connection-string-in-web-config
web.config for connection-string file for this. Also there is gloabal.asax which can help you.