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

some dropdown webcontrol questions...

whats the main difference between
cbo.SelectedItem.Value and cbo.SelectedValue. both return the same result, but why and when to use it? thanks
Nov 18 '05 #1
3 1050
hi Asha,

both are same..its only the way you want to access it.
if run reflector and see whats this cbo.SelectedValue is

public virtual ListItem get_SelectedItem()
{ int num1;
num1 = this.SelectedIndex;
if (num1 >= 0)
{
return this.Items[num1];
}
return null;
}
so if you have reference to ListItem (that is cbo.SelectedItem) you can
access the value as listItem.value
or cbo.SelectedValue if you have reference to cbo.

hth,
Av.

"Asha" <As**@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com...
whats the main difference between
cbo.SelectedItem.Value and cbo.SelectedValue. both return
the same result, but why and when to use it? thanks

Nov 18 '05 #2
add more to it, i would recommend cbo.SelectedValue to write less code and
make it faster.

Av.
"Asha" <As**@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com...
whats the main difference between
cbo.SelectedItem.Value and cbo.SelectedValue. both return
the same result, but why and when to use it? thanks

Nov 18 '05 #3
cbo.SelectedItem.Value dates back to ASP.NET 1.0, and was left in the 1.1 framework for backwards compatability. The cbo.SelectedValue is new to 1.1, and is a lot nicer (in terms of writing code) if you are just doing 1.1 work.

"Asha" wrote:
whats the main difference between
cbo.SelectedItem.Value and cbo.SelectedValue. both return the same result, but why and when to use it? thanks

Nov 18 '05 #4

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

Similar topics

1
by: Divya | last post by:
Hello This is my 1st project where I have to create a Webcontrol. I have created a simple custom control with a button and 2 labels added to a panel. My problem is that the event handler that I...
2
by: Steven | last post by:
This one should be a fairly simple one for you guys. I want to create a small dropDown list (custom control) and when the user selects anyone of the value, the control should pass back the Selected...
1
by: dollar | last post by:
I would like to use a DropDown List in a TemplateColumn in the DataGrid WebControl. How can I define the content of the dropdown list (Load it dynamically from a DB Table)? also i need to...
3
by: Peter Proost | last post by:
Hi I have made my own control with a dropdown functionality like a combobox and it works just great, but I've got one problem remaining. If you put a combobox on a panel and press the little arrow...
0
by: Kay | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
0
by: Kay O'Keeffe | last post by:
Hello, I have written my own custom control and I want one of its properties to display as a dropdown list when clicked, so the user can select from the list, it would be similar to the asp...
5
by: Kassad | last post by:
Two questions: 1. There is a dropdown box that has a whole bunch of values but it is not linked to a recordsource. I believe when this object was created the values were manually enterred but I...
1
by: redgoals | last post by:
Hi, I have searched the forum for a similar problem but have been unable to find anything. What i am trying to achieve is a dropdown menu which behaves in the following way: 1, Someone...
3
by: chris f | last post by:
In my table (ASP.NET 2) that is dynamically generated I have a cell that initially will only display N rows of text and hide the rest. (This is so that the rows have a small height and I can...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
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: 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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.