Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Stupid format question

Reply
Thread Tools

Stupid format question

 
 
=?Utf-8?B?R2hpc3Rvcw==?=
Guest
Posts: n/a
 
      08-27-2007
I know, this is a very simple question but...

I want to bound an ObjectDataSource with
a DropDownList.

And I want to do it like that :

Residential
Condominium
Duplex
Triplex
Land
Commercial Lands...

These come from a class with properties and I just want to insert blank
space or better, tab character in it. I tried it but when it come to the
browser, all my spaces are trim.

Why ?




 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      08-27-2007
if you use a real select, then you can use optgroup

<select>
<optgroup label="Residential">
<option>Condominium</option>
<option>Duplex</option>
<option>Triplex</option>
</optgroup>
<optgroup label="Land">
<option>Commercial</option>
</optgroup>
</select>


-- bruce (sqlwork.com)


Ghistos wrote:
> I know, this is a very simple question but...
>
> I want to bound an ObjectDataSource with
> a DropDownList.
>
> And I want to do it like that :
>
> Residential
> Condominium
> Duplex
> Triplex
> Land
> Commercial Lands...
>
> These come from a class with properties and I just want to insert blank
> space or better, tab character in it. I tried it but when it come to the
> browser, all my spaces are trim.
>
> Why ?
>
>
>
>

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-27-2007
On Aug 27, 9:20 pm, Ghistos <(E-Mail Removed)> wrote:
> I know, this is a very simple question but...
>
> I want to bound an ObjectDataSource with
> a DropDownList.
>
> And I want to do it like that :
>
> Residential
> Condominium
> Duplex
> Triplex
> Land
> Commercial Lands...
>
> These come from a class with properties and I just want to insert blank
> space or better, tab character in it. I tried it but when it come to the
> browser, all my spaces are trim.
>
> Why ?


use a non-breaking space character &nbsp;

 
Reply With Quote
 
=?Utf-8?B?R2hpc3Rvcw==?=
Guest
Posts: n/a
 
      08-27-2007
Tks Bruce

I find on the net
http://www.codeproject.com/aspnet/Dr...ptionGroup.asp

A dotNet dropdownList with the OptionGroup and Item based on what you say to
me.

It works very well...

I tried the &nbsp in my class but this method not work or maybe it's me.

Tks again

 
Reply With Quote
 
Lit
Guest
Posts: n/a
 
      08-27-2007
Ghistos,

have you been able to incorporate all the bug fixes for that Control from
the link you provided?

If you know a download that has all the fixed I appreciate it if you can
share it with us.

using the control as is I am getting

Error 1 The name 'ddlItems' does not exist in the current context
DropDownListOptionGroup.aspx.cs

Thank you,

Lit


"Ghistos" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Tks Bruce
>
> I find on the net
> http://www.codeproject.com/aspnet/Dr...ptionGroup.asp
>
> A dotNet dropdownList with the OptionGroup and Item based on what you say
> to
> me.
>
> It works very well...
>
> I tried the &nbsp in my class but this method not work or maybe it's me.
>
> Tks again
>



 
Reply With Quote
 
=?Utf-8?B?R2hpc3Rvcw==?=
Guest
Posts: n/a
 
      08-28-2007
I'm not sure to understand your problem.

I create a user control with the code. There's no bugs in the adapter. For
the code in the ascx.cs this is what I have done with comments from the
article...

Where CategorieBatimentList is a generic list of CategorieBatimentInfo.

I loop in my collection and then add the objects in my dropdownlist.

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{

CategorieBatimentList catBats =
CategoriesBatiment.GetCategoriesBatiment();
foreach (CategorieBatimentInfo catbat in catBats)
{
ListItem currentItem = new
ListItem(catbat.DescriptionFrancais, catbat.CodeCategorie);
currentItem.Attributes["OptionGroup"] =
catbat.DescriptionGroupeFrancais;
ddlCatBatiment.Items.Add(currentItem);
}
}
}
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
stupid, STUPID question! rincewind HTML 25 05-08-2009 01:07 PM
stupid question...waiting for a stupid answer Brandon McCombs Java 4 08-28-2006 06:57 PM
Stupid question. Please, only stupid responders. If you're not sureif you're stupid, you probably aren't. =?ISO-8859-1?Q?R=F4g=EAr?= Computer Support 6 07-18-2005 05:11 AM
stupid stupid stupid kpg MCSE 17 11-26-2004 02:59 PM
Stupid is as Stupid Does! Michael P Gabriel Digital Photography 3 06-26-2004 12:49 PM



Advertisments