473,382 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Please help me reference a control on my datalist.

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.
Nov 18 '05 #1
0 798

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Fink | last post by:
Hello, I have a user control that contains a datalist and within that a asp label, as follows: <asp:DataList ID="dlHomeDetail_Starters" Runat="server" CellPadding="1" CellSpacing="1"...
0
by: ani | last post by:
Hi, I have a datalist control and within the Itemplate I have a radiobuttonlist control . I am binding data to the datalist control in Page_load . Also I have sqldatareader object that needs...
2
by: Daniel | last post by:
I'm new to .Net and all of its abilities so I hope this makes sense. Basically I'm confused on when is the appropriate time to use web forms controls vs. regular HTML. For example in ASP...
3
by: jm | last post by:
Dim order_type As DropDownList = _ (CType(e.Item.FindControl("order_type"), DropDownList)) This control is in a datalist itemtemplate. It will not find it. Whenever I try and do anything...
1
by: mahsa | last post by:
H data I'm binding to the DataList is information about products in my product database. Perhaps passed in the QueryString to this page is a ProductID. I might want to make the item in the DataList...
4
by: mahsa | last post by:
my problem dosent solve yet I want to have claa void in onclick of my check bov if I us function setProps ( ) msg.innerText = "llll"; in <datalist> <ItemTemplate><input type="checkbox"...
9
by: Moe Sizlak | last post by:
Hi There, I am trying to write the selected value of a listcontrol when a button is clicked and I keep getting the error "object not set to a reference of an object". The libox itself is in a...
3
by: Martin | last post by:
Hi, I have a very frustrating problem that I have researched for countless hours to no avail. There are many posts asking very similar things, however none usefull in my situation. I am using VS...
4
by: Sam Martin | last post by:
Hi, I have got a User Control that contains for the sake of argument, a single DataList control. eg. <asp:DataList id="DataListMain" runat="server" RepeatDirection="Horizontal"...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.