Thursday, March 29, 2012

List Box

Hi Guys,

I need to append space in front of Directory names inside listbox based on
the folder level inside directory.

If i do
lBoxLocation.Items.Add(new ListItem(" "+
dirInfo[i].Name,dirInfo(i).FullName))

it adds in front of value. If i put white space, it dont appear at all.

Can someone tell me or guide me to an example which shows how to work with
this?

Thanks

MannyTry running your string through an HtmlDecode:

dim spaces as string = DecodedSpaces(2)
lBoxLocation.Items.Add(spaces + dirInfo[i].Name,dirInfo(i).FullName)

public shared function DecodedSpaces(numberOfSpaces as integer) as string
dim spaces as string = ""
for i as integer = 0 to numberofSpaces - 1
spaces &= " "
next
return HttpUtility.HtmlDecode(spaces)
end function

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

"Manny Chohan" <MannyChohan@.discussions.microsoft.com> wrote in message
news:15F021DD-2ABC-4F7C-96F8-8D3209CCC0B8@.microsoft.com...
> Hi Guys,
> I need to append space in front of Directory names inside listbox based on
> the folder level inside directory.
> If i do
> lBoxLocation.Items.Add(new ListItem(" "+
> dirInfo[i].Name,dirInfo(i).FullName))
> it adds in front of value. If i put white space, it dont appear at all.
> Can someone tell me or guide me to an example which shows how to work with
> this?
> Thanks
> Manny
"Manny Chohan" <MannyChohan@.discussions.microsoft.com> wrote in message news:15F021DD-2ABC-4F7C-96F8-8D3209CCC0B8@.microsoft.com...
> I need to append space in front of Directory names inside listbox based on
: :
> it adds in front of value. If i put white space, it dont appear at all.

Manny,

Whitespace will be normalized by the browser, so no matter how many consecutive
spaces you send they'll appear as only one on the user's screen.

What you need to do is prepend non-breaking spaces, , which the browser
won't force normalization of, e.g.,

lBoxLocation.Items.Add(new ListItem(" " + _
dirInfo[i].Name,dirInfo(i).FullName))

Each will take up one space when seen in the browser by the user.

Derek Harmon

List bound controls

Hi,

I have been reading information about asp.net webcontrols, and i have
found a term "List bound controls".

What are "List Bound Controls"?? Which are the differences between
these controls and the others?? how many webcontrols are list bound
controls?? any url in microsoft.com talking about lista bound
controls??

Any help would be very appreciate.

Thanks,

Alfredo BarrientosAlfredo,

List-Bound controls are any control that may be databound to a list of data
(usually retrieved from a database) these would include many controls
because almost any control may be databound. But controls that can actually
bind to every item in a list of data are ones such as CheckBoxList,
RadioButtonList, Datagrid, DataList, and Repeater.

To find out more information on these and other bindable controls I would
suggest starting with a few of the databinding tutorials which may be found
here: http://samples.gotdotnet.com/quickstart/aspplus/

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"Alfredo Barrientos" <abarrientos@.gmail.com> wrote in message
news:1129519240.655592.95510@.z14g2000cwz.googlegro ups.com...
> Hi,
> I have been reading information about asp.net webcontrols, and i have
> found a term "List bound controls".
> What are "List Bound Controls"?? Which are the differences between
> these controls and the others?? how many webcontrols are list bound
> controls?? any url in microsoft.com talking about lista bound
> controls??
> Any help would be very appreciate.
> Thanks,
> Alfredo Barrientos
Thanks Justin,

In your page I cant find the documentation about ListBound controls.
Could Any ASP.Net MVP answer this question??

Thanks,

Alfredo Barrientos

List bound controls

Hi,
I have been reading information about asp.net webcontrols, and i have
found a term "List bound controls".
What are "List Bound Controls"' Which are the differences between
these controls and the others' how many webcontrols are list bound
controls' any url in microsoft.com talking about lista bound
controls'
Any help would be very appreciate.
Thanks,
Alfredo BarrientosAlfredo,
List-Bound controls are any control that may be databound to a list of data
(usually retrieved from a database) these would include many controls
because almost any control may be databound. But controls that can actually
bind to every item in a list of data are ones such as CheckBoxList,
RadioButtonList, Datagrid, DataList, and Repeater.
To find out more information on these and other bindable controls I would
suggest starting with a few of the databinding tutorials which may be found
here: http://samples.gotdotnet.com/quickstart/aspplus/
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Alfredo Barrientos" <abarrientos@.gmail.com> wrote in message
news:1129519240.655592.95510@.z14g2000cwz.googlegroups.com...
> Hi,
> I have been reading information about asp.net webcontrols, and i have
> found a term "List bound controls".
> What are "List Bound Controls"' Which are the differences between
> these controls and the others' how many webcontrols are list bound
> controls' any url in microsoft.com talking about lista bound
> controls'
> Any help would be very appreciate.
> Thanks,
> Alfredo Barrientos
>
Thanks Justin,
In your page I cant find the documentation about ListBound controls.
Could Any ASP.Net MVP answer this question'
Thanks,
Alfredo Barrientos

list box

I have a list box that is populated from my dataset. I add a new item in
there called "ALL". In this list box the user can select more then one item,
my question is, if they select ALL can i disable the multi selection
capability? So if ALL is selected they can't hold down the CTRL key and
select more.I believe, there is no builtin property in listbox control for this

but, this is simple to implement in javascript.. you will not be able to
disable some options in a select box but will be able to deselect the other
selections or display a message if ALL is selected.

Following function would deselect all except first item in the list...

function Deselect()
{
var theDayElement = window.document.form1.cmbDay

var optionCounter;
for (optionCounter = 1; optionCounter < theDayElement.length;
optionCounter++)
{
theDayElement.options[optionCounter].selected=false;
}
}

This function would check if first option (ALL) is selected and call
deselect() to deselect all other options

function CheckValue()
{
if(window.document.form1.cmbDay.options[0].selected == true)
DeselectAll();
}

your Select tag would look like below

<SELECT NAME="cmbDay" ID="cmbDay" multiple onchange="CheckValue();"
Hope this helps...

"NuB" wrote:

> I have a list box that is populated from my dataset. I add a new item in
> there called "ALL". In this list box the user can select more then one item,
> my question is, if they select ALL can i disable the multi selection
> capability? So if ALL is selected they can't hold down the CTRL key and
> select more.
>
>
>

list box

I have a list box that is populated from my dataset. I add a new item in
there called "ALL". In this list box the user can select more then one item,
my question is, if they select ALL can i disable the multi selection
capability? So if ALL is selected they can't hold down the CTRL key and
select more.I believe, there is no builtin property in listbox control for this
but, this is simple to implement in javascript.. you will not be able to
disable some options in a select box but will be able to deselect the other
selections or display a message if ALL is selected.
Following function would deselect all except first item in the list...
function Deselect()
{
var theDayElement = window.document.form1.cmbDay
var optionCounter;
for (optionCounter = 1; optionCounter < theDayElement.length;
optionCounter++)
{
theDayElement.options[optionCounter].selected=false;
}
}
This function would check if first option (ALL) is selected and call
deselect() to deselect all other options
function CheckValue()
{
if( window.document.form1.cmbDay.options[0].selected == true)
DeselectAll();
}
your Select tag would look like below
<SELECT NAME="cmbDay" ID="cmbDay" multiple onchange="CheckValue();">
Hope this helps...
"NuB" wrote:

> I have a list box that is populated from my dataset. I add a new item in
> there called "ALL". In this list box the user can select more then one ite
m,
> my question is, if they select ALL can i disable the multi selection
> capability? So if ALL is selected they can't hold down the CTRL key and
> select more.
>
>
>

List Box

Hi Guys,
I need to append space in front of Directory names inside listbox based on
the folder level inside directory.
If i do
lBoxLocation.Items.Add(new ListItem(" "+
dirInfo[i].Name,dirInfo(i).FullName))
it adds in front of value. If i put white space, it dont appear at all.
Can someone tell me or guide me to an example which shows how to work with
this?
Thanks
MannyTry running your string through an HtmlDecode:
dim spaces as string = DecodedSpaces(2)
lBoxLocation.Items.Add(spaces + dirInfo[i].Name,dirInfo(i).FullName)
public shared function DecodedSpaces(numberOfSpaces as integer) as string
dim spaces as string = ""
for i as integer = 0 to numberofSpaces - 1
spaces &= " "
next
return HttpUtility.HtmlDecode(spaces)
end function
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Manny Chohan" <MannyChohan@.discussions.microsoft.com> wrote in message
news:15F021DD-2ABC-4F7C-96F8-8D3209CCC0B8@.microsoft.com...
> Hi Guys,
> I need to append space in front of Directory names inside listbox based on
> the folder level inside directory.
> If i do
> lBoxLocation.Items.Add(new ListItem(" "+
> dirInfo[i].Name,dirInfo(i).FullName))
> it adds in front of value. If i put white space, it dont appear at all.
> Can someone tell me or guide me to an example which shows how to work with
> this?
> Thanks
> Manny
>
"Manny Chohan" <MannyChohan@.discussions.microsoft.com> wrote in message news:15F021DD-2ABC-
4F7C-96F8-8D3209CCC0B8@.microsoft.com...
> I need to append space in front of Directory names inside listbox based on
: :
> it adds in front of value. If i put white space, it dont appear at all.
Manny,
Whitespace will be normalized by the browser, so no matter how many consecut
ive
spaces you send they'll appear as only one on the user's screen.
What you need to do is prepend non-breaking spaces, , which the browse
r
won't force normalization of, e.g.,
lBoxLocation.Items.Add(new ListItem(" " + _
dirInfo[i].Name,dirInfo(i).FullName))
Each will take up one space when seen in the browser by the user.
Derek Harmon

List Box and different color

There is a way to give different color to listitems of a ListBox ?Yes, it is, but needs a bit work as basically it would need to be done so
that every ListItem in the ListBox has custom style attributes. Those
attributes are then rendered at the HTML. Only problem is that this works by
default only in HtmlSelect control.

See:
http://support.microsoft.com/defaul...kb;en-us;309338

So if you absolutely need ListBox, you would need to rewrite some
implementation for the control.

--
Teemu Keiski
MCP,Designer/Developer
Mansoft tietotekniikka Oy
http://www.mansoft.fi

ASP.NET Forums Moderator, www.asp.net
AspAlliance Columnist, www.aspalliance.com

Email:
joteke@.aspalliance.com

"Alessandro" <gemini_two@.hotmail.com> kirjoitti viestiss
news:eNohrkhQDHA.2320@.TK2MSFTNGP12.phx.gbl...
> There is a way to give different color to listitems of a ListBox ?