Click here to Skip to main content
15,898,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii ,

What i want to do is ... the text field of dropdown , i just i want to limit the string ..

if the text is more than 20 then it should be

"df gfgf hf hgh.."

Please suggets
Posted
Comments
Sibasisjena 22-Dec-14 6:46am    
Hi Torakami,

How are you binding the dropdownlist. In C#?
Praveen Kumar Upadhyay 22-Dec-14 7:13am    
You just need to set the width of the Dropdown. But if you want to wrap the text with .... then better you do it with the sql query itself.

1 solution

or you can manage it in query and then display :-
Here is List of customers:-
SELECT CNAME FROM dbo.CUSTOMER   

CNUM	CNAME
2001	HOFFMAN
2003	LIU
2004	GRASS
2005	CLAMERS
2006	CINUS
2007	PERERIA
2008	LIU


Here in this example, I will show only first 5 characters of Customer Name :-
SELECT CNUM,CASE WHEN LEN(CNAME) > 5 THEN SUBSTRING(CNAME,0,6) + '..' ELSE CNAME END CNAME  FROM dbo.CUSTOMER 

CNUM	CNAME
2001	HOFFM..
2003	LIU
2004	GRASS
2005	CLAME..
2006	CINUS
2007	PERER..
2008	LIU
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900