473,661 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Syntax for adding new list item?

If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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 4287
Should be right.

is System.Web.UI.W ebControls imported?

What's the actual error?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"JP" <JP@discussions .microsoft.comw rote in message
news:F1******** *************** ***********@mic rosoft.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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.W ebControls imported?

What's the actual error?

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/
"JP" <JP@discussions .microsoft.comw rote in message
news:F1******** *************** ***********@mic rosoft.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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.comw rote in message
news:F1******** *************** ***********@mic rosoft.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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.comw rote in message
news:F1******** *************** ***********@mic rosoft.com...
If have a dropdown control and have set this to the first position of the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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.comw rote in message
news:82******** *************** ***********@mic rosoft.com...
thank mark. now i feel like a complete fool!

"Mark Rae" wrote:
>"JP" <JP@discussions .microsoft.comw rote in message
news:F1******* *************** ************@mi crosoft.com...
If have a dropdown control and have set this to the first position of
the
dropdown":
ddUserRole.Item s.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.Item s.Insert(0, New ListItem("0","S elect 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.comw rote in message
news:82******** *************** ***********@mic rosoft.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
2832
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
33869
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
23
1857
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 relate right now. I've been struggling for days--days!!-- on this one simple query. I really need to get past this thing and move on. Please help. I have a classic ASP page, and it gives you 4 dropdowns. You can select any or none of them....
19
2964
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 $ Last-Modified: $Date: 2003/09/22 04:51:49 $ Author: Nicolas Fleury <nidoizo at gmail.com> Status: Draft Type: Standards Track
26
2808
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 - Specified argument was out of the range of valid values. Parameter name: '-1' is not a
6
2161
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. === PEP: xxx Title: Unification of for-statement and list-comprehension syntax
1
2463
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 guy's Javascript "combo box" - http://sandy.mcarthur.org/javascript/select/select.html. It allows my users (when I get some!) to select from a list of preexisting options and also to add a new one by clicking on "add new". Essentially it's a select...
0
1897
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 //... comboBox1.DataSource = lst; This work fine, items appear. Now I have a button near the combo box and I want to add a new element
1
7235
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
5319
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 but don't know how. Heres my xsl file so far. <?xml version="1.0" encoding="ISO-8859-1" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" ...
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8855
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5653
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4346
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1986
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.