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

Syntax for adding new list item?

If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under ListItem.
Can anyone help out with the correct syntax?
Feb 13 '07 #1
6 4279
Should be right.

is System.Web.UI.WebControls imported?

What's the actual error?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"JP" <JP@discussions.microsoft.comwrote in message
news:F1**********************************@microsof t.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under
ListItem.
Can anyone help out with the correct syntax?
Feb 13 '07 #2
That's what I thought too. Forgot to mention this is an ASP 2.0 app.
The squiggly line appears under ListItem and under the last parenthesis.

The error for the ListItem is: ") expected"
The errors for the last paren are: "; expected" and "Invalid expression
term ')'"
double quotes are not part of the error.
"Karl Seguin [MVP]" wrote:
Should be right.

is System.Web.UI.WebControls imported?

What's the actual error?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"JP" <JP@discussions.microsoft.comwrote in message
news:F1**********************************@microsof t.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under
ListItem.
Can anyone help out with the correct syntax?
Feb 14 '07 #3
"JP" <JP@discussions.microsoft.comwrote in message
news:F1**********************************@microsof t.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under
ListItem.
Can anyone help out with the correct syntax?
That's because C# is case-sensitive - change "New" to "new" and all will be
well again...
Feb 14 '07 #4
thank mark. now i feel like a complete fool!

"Mark Rae" wrote:
"JP" <JP@discussions.microsoft.comwrote in message
news:F1**********************************@microsof t.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under
ListItem.
Can anyone help out with the correct syntax?

That's because C# is case-sensitive - change "New" to "new" and all will be
well again...
Feb 14 '07 #5
lol..I don't feel too bad about missing it...I've gotten used to text
editors capitalizing code when they ought note...just read past it now..

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"JP" <JP@discussions.microsoft.comwrote in message
news:82**********************************@microsof t.com...
thank mark. now i feel like a complete fool!

"Mark Rae" wrote:
>"JP" <JP@discussions.microsoft.comwrote in message
news:F1**********************************@microso ft.com...
If have a dropdown control and have set this to the first position of
the
dropdown":
ddUserRole.Items.Insert(0, "Select Role...");

But, I want to be able to set the value of the above item to zero. I
thought it was this:
ddUserRole.Items.Insert(0, New ListItem("0","Select Role..."));

but it doesn't seem to be the case. I get the squigly line under
ListItem.
Can anyone help out with the correct syntax?

That's because C# is case-sensitive - change "New" to "new" and all will
be
well again...
Feb 14 '07 #6
"JP" <JP@discussions.microsoft.comwrote in message
news:82**********************************@microsof t.com...
thank mark. now i feel like a complete fool!
We've all been there, mate... :-)
Feb 14 '07 #7

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

Similar topics

11
by: Andreas Neudecker | last post by:
Hello. I am relatively new to Python and I have a strange problem with some code. In a class the __call__ method gets parameters like this: class WhatsUp: __call__ ( self, var1,
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
23
by: middletree | last post by:
I've seen posts here and elsewhere which read something along the lines of "PULLNG MY HAIR OUT!!!!!" or "HELLLLPPP!". Well, I know that kind of subject line isn't descriptive, but I sure can...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
26
by: Simon Jefferies | last post by:
Hello, I am trying to add an item to a checked list box, like: clbList.Items.add("Hello",true) I get an error back: Run-time exception thrown: System.ArgumentOutOfRangeException -...
6
by: Heiko Wundram | last post by:
Hi all! The following PEP tries to make the case for a slight unification of for statement and list comprehension syntax. Comments appreciated, including on the sample implementation. ===...
1
by: The Eclectic Electric | last post by:
I'd be very grateful if anyone could help me with this. From my limited knowledge of Javascript I don't think it is possible, but I'll punt anyway. I downloaded and very slightly adapted this...
0
by: marcobx | last post by:
I have a ComboBox and a List of objects to popolate items. I use the DataSource property and not the List collection: List<foolst = new List<foo>; //add elements into the list //......
1
by: libish | last post by:
can we add a value to a list item?? i got a list with some list members here can we add a value to that list item??? ie. suppose a list contains items like "item1" "item2" "item3" etc...
1
by: cleary1981 | last post by:
Hi, I am trying to add page numbers to my document in xsl fo. I can get the page numbers to work but I need them to show at the bottom of each page. I know you can define an area as region-after...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.