I have a problem I cannot find a solution to. I have a drop-down list that is dynamically filled with a set of values. By viewing the source code in the browser I can tell that this list is correctly filled with the "value" and "text" parameters.
But if I try to retrieve the value using ddl.SelectedItem.Value I get the error "Object reference not set to an instance of an object" which means that there is no parameter in "value" to retrieve ...
Page_Load() contains an "If Not IsPagePostback" in which the list is filled. I don't want to use AutoPostback = True since I want to retrieve the value-parameter when I click a "save" button. I must have missed something fundamental here that I do not grasp ...
The code to fill the list looks like this:
This snippet does not generate any errors: Everything is printed as it should! But inside my Submit-function I cannot be retrieve the parameter:
Can anyone help me? I really need to get this right...
But if I try to retrieve the value using ddl.SelectedItem.Value I get the error "Object reference not set to an instance of an object" which means that there is no parameter in "value" to retrieve ...
Page_Load() contains an "If Not IsPagePostback" in which the list is filled. I don't want to use AutoPostback = True since I want to retrieve the value-parameter when I click a "save" button. I must have missed something fundamental here that I do not grasp ...
The code to fill the list looks like this:
VB.NET:
Dim ds as Dataset ()
ds.ReadXml([I]the path to an xml file[/I])
ddl.Items.Add(New ListItem("destination", "destination"))
ddl.DataSource = ds.Tables(0).DefaultView
ddl.DataBind()
VB.NET:
objcmd.parameter.add("?destination", OdbcType.VarChar).Value = ddl.SelectedItem.Value