Hello,
DropDownList2's item values are assigned on the client side with javascript. THis is so they can depend on the item values of DropDownList1 without involving the server. WHen a button is clicked to submit the form, a query is run in the code behind using values from DropDownList2 and I get this error
System.NullReferenceException: Object reference not set to an instance of an object.
THis code behind line is highlighted in the error message
Dim wherepart As String = "where " + DropDownList2.SelectedItem.Value + " like @lookfor" + " and "
I think DropDownList2.SelectedItem.Value is not being seen there.
When DropDownList2's item values are set in a control in the aspx page or assigned in the code behind, the query runs fine.
1. HOw do you get a value assigned client side to been seen in a function in the code behind?
2. Should I not do things this way at all?
DropDownList2's item values are assigned on the client side with javascript. THis is so they can depend on the item values of DropDownList1 without involving the server. WHen a button is clicked to submit the form, a query is run in the code behind using values from DropDownList2 and I get this error
System.NullReferenceException: Object reference not set to an instance of an object.
THis code behind line is highlighted in the error message
Dim wherepart As String = "where " + DropDownList2.SelectedItem.Value + " like @lookfor" + " and "
I think DropDownList2.SelectedItem.Value is not being seen there.
When DropDownList2's item values are set in a control in the aspx page or assigned in the code behind, the query runs fine.
1. HOw do you get a value assigned client side to been seen in a function in the code behind?
2. Should I not do things this way at all?