x.Parameters.AddWithValue("@areasexpertise1", FindControl("AreasExpertise1"))
It should find AreasExpertise1 and make a paramete开发者_JS百科r, but does that get the selectedvalue too?
The code you posted will find the control and will return it as a Control
object.
You need to cast it to whatever control it is (DropDownList or RadioButtonList, or whatever it is you are using), and then call the SelectedValue
property on it in order to do so:
var ctrl = FindControl("AreasExpertise1") as DropDownList;
if (ctrl != null)
x.Parameters.AddWithValue("@areasexpertise1", ctrl.SelectedValue)
精彩评论