Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Stupid format question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ghistos - 27 Aug 2007 20:20 GMT
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 ?
bruce barker - 27 Aug 2007 20:59 GMT
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)

> I know, this is a very simple question but...
>
[quoted text clipped - 17 lines]
>
>    
Alexey Smirnov - 27 Aug 2007 21:18 GMT
> I know, this is a very simple question but...
>
[quoted text clipped - 15 lines]
>
> Why ?

use a non-breaking space character &nbsp;
Ghistos - 27 Aug 2007 22:06 GMT
Tks Bruce

I find on the net
http://www.codeproject.com/aspnet/DropDownListOptionGroup.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
Lit - 27 Aug 2007 23:40 GMT
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

> Tks Bruce
>
[quoted text clipped - 10 lines]
>
> Tks again
Ghistos - 28 Aug 2007 16:48 GMT
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);
           }
       }
   }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.