473,387 Members | 1,529 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,387 software developers and data experts.

Using For Each to update controls in repeater

Guys,

I have a webform that uses a datalist control to display
a series of thumbnail images. Each image is is also associated
with two dropdown lists. One contains the quantity
of images required and the other contains the size
of the image that is requried. The qty dropdown list
is populated as follows:

dlQty = CType(e.Item.FindControl("dlQty"), DropDownList)
dlQty.Items.Clear()
dlQty.SelectedIndex = 0
dlQty.Items.Add("0")
dlQty.Items.Add("1")
dlQty.Items.Add("2")
dlQty.Items.Add("3")
dlQty.Items.Add("4")
dlQty.Items.Add("5")

where dlQty is defined as

Protected WithEvents dlQty As DropDownList

and the size dtopdown list is populated as follows using an
array of strings that contain the sizes:

Try
dlSize1 = CType(e.Item.FindControl("dlSize"),
DropDownList)
If Not IsNothing(dlSize1) Then
Dim rp() As String = CType(Session("rep"),
String())
Dim r As String
For Each r In rp
dlSize1.Items.Add(r)
Next
dlSize1.SelectedIndex = 0
End If
Catch ex As Exception
Label1.Text = ex.Message.ToString
End Try

where dlSize1 is defined as

Protected WithEvents dlSize1 As DropDownList

The contents of the array are obtained from a database during the
page preLoad event.

These sections of code are executed in the DataList1.ItemCreated
handler routine.

This code works without error when run on my local development
machine and also on our intranet server. It also runw without
any problems on one of the web hosting servers that I have an
account. My client has hosting at a different ISP, that assures
me that they are capable of supporting ASP.NET V2.

However, when I run this routine on their server it get an

Object reference not set to an instance of an object

exception raised when trying to populate the dlSize dropdowns.

Other code is also executed in the ItemDataDBound event of
the datalist control.

Anyone got any suggestions why most serves cope with this
code and yet another one fails to recognise the controls?

Many thanks,

Jason.
Jun 15 '06 #1
0 1072

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

Similar topics

1
by: Dmitri Shvetsov | last post by:
Hi All, Is it possible at all, and if yes, then how? Or it's very/extremely hard to do that? Maybe somebody knows...) I'm writing a Web App using VS2003/C#/MSSQL. I'm currently having about...
2
by: theComputer7 | last post by:
I cut down the code to make this half way understandable... I have read Data Grid girls caution about over use of dynamic controls. I truly believe what I am doing requires dynamically inserted...
8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
2
by: Jordan | last post by:
I'm curious if the whole point of Repeaters/Data Lists/Grids is encapsulating additional functionality like add/update/edit/deletes, but really does not provide any benefits when it comes to simply...
4
by: John Holmes | last post by:
I'm using data to rename some web controls on a form that uses a repeater contol and so it can have mulitple instances of the same control set. The controls get renamed (thanks to Steven Cheng's...
2
by: Antoine | last post by:
I would like to construct my own list of items in a grid/ table/ item list layout but I have a problem. I want to add a sort of index row based on time, such as there might be blank values. Sure...
0
by: =?Utf-8?B?S29uc3RhbnRpbg==?= | last post by:
I have a need to have a repeater inside update panel control which should update dynamically when "Update" button is clicked. I have repeater inside update panel control which takes custom...
2
by: Jesper Rou | last post by:
Hi all, I have a peculiar problem in that I want to have an Ajax.Net update panel, inside each item in a repeater. Like so: <repeater> <itemtemplate> <updatepanel>
0
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
(This is a continuation of my earlier post - 'Beginners question about binding/formatting a repeater'.) I'm trying to write a fairly minimal web app using a repeater control. I am accustomed to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.