DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 19 Jul 2007 11:30:45 +0700,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    វិចិត្រ Vichet
          2    David R. Longnecker am
          3    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]


Drop Down List   
Dear All;

i want to display data in dropdown list with extend alignment as follow:


ADB.............1 Project
WB.............12 Project
WFP.............5 Project


but if i concatenate string it display as follow:

ADB........1 Project
WB..............12 Project
WFP........5 Project
Date:Thu, 19 Jul 2007 11:30:45 +0700   Author:  

Re: Drop Down List   
Since exact typography will differ based on culture, font, etc... having 
them align perfectly without graphics is a bit tricky.  I'd did something 
like this a bit back for a drop down list and it has worked well.  It seems 
a bit bloated, so if anyone out there has another idea... Here's an example 
using the data you provided.

    protected void Page_Load(object sender, EventArgs e)
    {
        DropDownList1.Items.Add(CreateJustifiedText("ADB", "1 Project", 25));
        DropDownList1.Items.Add(CreateJustifiedText("WB", "12 Project", 25));
        DropDownList1.Items.Add(CreateJustifiedText("WFP", "5 Project", 25));
    }

    private static string CreateJustifiedText(string stringValue1, string 
stringValue2, int maxLength)
    {
        int stringLengths = stringValue1.Length + stringValue2.Length;
        int dotsNeeded = maxLength - stringLengths;
        string dots = "";
        for (int i=0; i < dotsNeeded; i++)
        {
            dots += ".";
        }
        return stringValue1 + dots + stringValue2;
    }

The generated HTML looks like:

<select name="DropDownList1" id="DropDownList1">
<option value="ADB.............1 Project">ADB.............1 Project</option>
<option value="WB.............12 Project">WB.............12 Project</option>
<option value="WFP.............5 Project">WFP.............5 Project</option>
</select>

Hope this helps!

-dl

--
David R. Longnecker
http://blog.tiredstudent.com


> Dear All;
> 
> i want to display data in dropdown list with extend alignment as
> follow:
> 
> ADB.............1 Project
> WB.............12 Project
> WFP.............5 Project
> but if i concatenate string it display as follow:
> 
> ADB........1 Project
> WB..............12 Project
> WFP........5 Project
Date:Thu, 19 Jul 2007 13:26:11 +0000 (UTC)   Author:  

Re: Drop Down List   
I suggest you use a fixed size font such as Courier.
This will help keep things aligned.

-- 
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net


"វិចិត្រ Vichet"  wrote in message 
news:%23XdaT2byHHA.4392@TK2MSFTNGP04.phx.gbl...

> Dear All;
>
> i want to display data in dropdown list with extend alignment as follow:
>
>
> ADB.............1 Project
> WB.............12 Project
> WFP.............5 Project
>
>
> but if i concatenate string it display as follow:
>
> ADB........1 Project
> WB..............12 Project
> WFP........5 Project 
Date:Wed, 25 Jul 2007 07:26:48 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us