About Jeff Allen Expertise I can answer basic to intermediate questions related to Classic ASP.I can answer Intermediate to Advanced questions CSS& HTML, and basic questions about JavaScript and Ajax. I can also answer questions related to web page accessibility under US Section 508.
Experience I have 8 years experience with HTML. I have been developing in ASP, VBScript and CSS for two years each. I also currently work as web developer.
Organizations IWA-HWG
Education/Credentials I have a BA in English with minors in Web Design and Scientific and Technical Writing
Expert: Jeff Allen Date: 12/13/2006 Subject: Resize the text in textbox to fix inside the textbox
Question I think misunderstand my question
because the 22 is give an example
that means is dynamic one
i retrieve the data from database when put on the textbox it will automatic make the font size become smaller than it will fix to the textbox.
is it posible? i no want set any textbox width or size
-------------------------------------------
The text above is a follow-up to ...
-----Question-----
Hi, I have a textbox without setting any width and length.
So how i can fix all my text that take from database into textbox which show out all the contain in textbox no need to scroll behind the textbox to see the text.
It means the textbox can show only 20 length of text
but my retrive value is 22 length so the other will not show out and hide at behind the textbox
so now i want show all the 22 length of text into the textbox.
-----Answer-----
Set the textbox's size attribute to 22 or greater..
In HTML / ASP
<input type="text" name="myTextBox" id="myTextBox" size="25" />
In ASP.NET
<asp:TextBox ID="myTextBox" runat="server" Width="25"></asp:TextBox>
and you should be fine....
Answer Okay, so you want to adjust the font size inside the textbox based off the length of the string? This could get very small depending on the length of the string. I personally wouldn't recommend doing it this way but...
If you want to do it anyway I can think of one maybe two possible ways...
1. Why don't you just insert a local style rule to the textbox by appending the style attribute to it and setting it up like this: style="font-size="10px;" where you stick in the numeric value of the font size you want in pixels.
So you would in effect have <input type="text" name="myTextBox" id="myTextBox" style="font-size:10px;" />
The downside of course being as you know default field size for a text box is 20 so if you try to stick 50 characters (including spaces) in there the text (if adjusted dynamically to be something like 1/5 its normal size) will be almost unreadable in some cases.
I know this (inserting the style rule dynamically) could be done using JavaScript but I'm not absolutely certain you could do it using ASP unless you dynamically wrote all the code for the text box as welland did the whole insert when you wrote out the record...
2. There might be a way using JavaScript and CSS to dynamically manipulate the font-size of the text box but if so I am not certain how that would be done but I am sure you could google that and get an answer.