J
jm
I have this error:
Object reference not set to an instance of an object.
for:
Dim order_type As DropDownList = _
(CType(e.Item.FindControl("order_type"), DropDownList))
dim sqlString as string= "SELECT * FROM tblorders"
Dim conn As New OdbcConnection("DSN=mydsn")
conn.open()
dim ds as New DataSet()
Dim myDataAdapter as odbcdataadapter
myDataAdapter = New odbcdataadapter(sqlString, conn)
myDataAdapter.Fill(ds)
order_type.DataSource=ds <-dies here problem line; this is a
dropdownlist
order_type.datatextfield="order_long_desc"
order_type.datavaluefield="order_short_desc"
order_type.DataBind()
It is in a datalist. This is in the onitemcreated event. It failed on
the onitemdatabound also. I am trying to populate a dropdownlist. This
event is being called when "Edit" is clicked. It is not the initial
entry form. I have been trying everything to reference this control.
If I simply put the dim statement by itself, I get no error. Thank you
for saving my sanity.
Why is it telling me there is no control? I thought these events
mentioned are the last time to get TO the controls themselves. Thanks.
Object reference not set to an instance of an object.
for:
Dim order_type As DropDownList = _
(CType(e.Item.FindControl("order_type"), DropDownList))
dim sqlString as string= "SELECT * FROM tblorders"
Dim conn As New OdbcConnection("DSN=mydsn")
conn.open()
dim ds as New DataSet()
Dim myDataAdapter as odbcdataadapter
myDataAdapter = New odbcdataadapter(sqlString, conn)
myDataAdapter.Fill(ds)
order_type.DataSource=ds <-dies here problem line; this is a
dropdownlist
order_type.datatextfield="order_long_desc"
order_type.datavaluefield="order_short_desc"
order_type.DataBind()
It is in a datalist. This is in the onitemcreated event. It failed on
the onitemdatabound also. I am trying to populate a dropdownlist. This
event is being called when "Edit" is clicked. It is not the initial
entry form. I have been trying everything to reference this control.
If I simply put the dim statement by itself, I get no error. Thank you
for saving my sanity.
Why is it telling me there is no control? I thought these events
mentioned are the last time to get TO the controls themselves. Thanks.