473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Extending size according to content

22
I'm trying to adjust the size of a templatefield box so it shows all the data entered after Updating instead of having scroll bars and having to go up and down to see all the data in that field.

Any ideas?

Thanks!
Oct 25 '07 #1
2 1075
jhardman
3,406 Expert 2GB
You could probably make a good approximation of the size you need by using len(). You would need an empirical formula (one based on trial and error, rather than starting form basic principles) to calculate size. Something like this might work:
Expand|Select|Wrap|Line Numbers
  1. if len(request("textInput")) > 400 then %>
  2.    <textarea cols="75" rows="<%=5+int((len(request("textInput"))-400)/75)%>">
  3. <%
  4. else %>
  5.    <textarea cols="75" rows="5">
  6. <%
  7. end if %>
Only an approximation will do, font sizes are notoriously sizes set by browsers rather than the HTML code, especially in cases like inside textareas. Let me konw if this helps.

Jared
Oct 26 '07 #2
Barno77
22
Thanks for the quick reply and let you konw it goes! Appreciate it!
You could probably make a good approximation of the size you need by using len(). You would need an empirical formula (one based on trial and error, rather than starting form basic principles) to calculate size. Something like this might work:
Expand|Select|Wrap|Line Numbers
  1. if len(request("textInput")) > 400 then %>
  2.    <textarea cols="75" rows="<%=5+int((len(request("textInput"))-400)/75)%>">
  3. <%
  4. else %>
  5.    <textarea cols="75" rows="5">
  6. <%
  7. end if %>
Only an approximation will do, font sizes are notoriously sizes set by browsers rather than the HTML code, especially in cases like inside textareas. Let me konw if this helps.

Jared
Oct 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Petre Huile | last post by:
I have designed a site for a client, but they have hired an internet marketing person to incrase their search engine ranking and traffic. He wants to put extra-large fonts on every page which will...
4
by: Daniel Fugmann | last post by:
Hello, I use popups to show small pieces of information. These texts vary much in their lenghts and I dislike fixed size popups here because when the text is short there is so much empty space....
4
by: Matt | last post by:
Hi, I've been thinking about how to do this, but can't think of a solution. I have a class that is derived from System.Web.UI.WebControls.DataGrid which works a treat, but I'd like to extend...
8
by: Anthony Williams | last post by:
Morning all, I'm having a wee problem with a project I'm working on at the moment. I'm leading my company into producing a website, based upon Web Standards, which will be created using XHTML...
19
by: JezB | last post by:
I have a DIV whose contents varies in size according to data. How can I size the DIV precisely to fit it's contents ?
5
by: vbgunz | last post by:
Hello everyone. I own two books. Learning Python and Python in a nutshell. When cross referencing the two books to try and clarify the ideas behind extending methods and delegates, this is where...
4
by: Ian Richardson | last post by:
Hi, The function I've put together below is a rough idea to extend a SELECT list, starting from: <body> <form name="bambam"> <select id="fred"> <option value="1">1</option> <option...
11
by: Xah Lee | last post by:
Of interest: • The Semicolon Wars, by Brian Hayes. 2006. http://www.americanscientist.org/template/AssetDetail/assetid/51982 in conjunction to this article, i recommend: • Software...
7
by: khatarnakkhatri | last post by:
<html> <body> <table style="height:100%;width:100%;table-layout:fixed;" border="0" cellspacing="0" cellpadding="0"> <tr> <td style="height:15px;width:100%;background-color:green;"> ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.