I have several dropdownlists in each row of a gridview. I cannot make them wide enough to show their contents fully but would like to do this dynamically upon selection.
So, say dd1 is 80px wide. I want it to grow to 150 px wide when it drops down to display its contents. After selection, I want it to go back to original size.
I rwally don't care if it pushes other content aside or just overlays the new wider size.
bilmar
Member
132 Points
117 Posts
Set Dropdownlist to expand to width of text on selection?
Feb 25, 2008 03:36 PM|LINK
I have several dropdownlists in each row of a gridview. I cannot make them wide enough to show their contents fully but would like to do this dynamically upon selection.
So, say dd1 is 80px wide. I want it to grow to 150 px wide when it drops down to display its contents. After selection, I want it to go back to original size.
I rwally don't care if it pushes other content aside or just overlays the new wider size.
Any ideas on how to achieve this?
Thanks
Bill
bullpit
All-Star
21838 Points
4822 Posts
Re: Set Dropdownlist to expand to width of text on selection?
Feb 25, 2008 04:03 PM|LINK
See if this helps:
http://forums.asp.net/t/1115074.aspx
Max
Let Me Google That For You!
Avinash Desa...
Contributor
2161 Points
721 Posts
Re: Set Dropdownlist to expand to width of text on selection?
Feb 26, 2008 08:33 AM|LINK
Hi
Use this below code you will get if i am wrong please let me know
Protected Sub Dropdownlist1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Dropdownlist1.Width="Auto" End Sub~Avinash desai~
Software Developer
Bangalore
Please remember to click "Mark as Answer" on this post if it helped you.
bilmar
Member
132 Points
117 Posts
Re: Set Dropdownlist to expand to width of text on selection?
Feb 27, 2008 04:05 PM|LINK
Thanks,
The javascript solution looks to be the way to go since I want it to resize while selecting - prior to a postback.
Thanks
Bill