|
Hi there,
To dynamically increase the height of the textarea, you simply set the rows property. Normally, the user presses Enter to begin a new line, so you can check that to decide if you need to increase the rows property of the textarea. Here is the sample code for doing that:
function AddRow(e)
{
if(e.keyCode == 13)
{
var txtArea = document.getElementById("TEXTAREA1");
txtArea.rows = txtArea.rows + 1;
}
}
<TEXTAREA id="TEXTAREA1" onkeypress="AddRow(event);" ... ></TEXTAREA> Also, you might need to check when the user pastes the text into the textarea. However, when the rows is too big, the textarea won't look friendly, and I'm curious why the auto scrollbar does not help you here.
|
|
|
|
|
Hello, thanks for your reply. I'd like to know how I can detect the soft wrap return. I mean when the user keep typing to the end of the row, there will be a soft return inserted and a new line will be added. Is there a way to detect this?
I will put the textbox control in a table and make the height of that row and text box increase to fit the user's input. Why do I do this? Because in our desktop version software, we did it that way. My boss would love to see a web application can do it in the same way.
|
|
|
|
|
I'm not sure if there is a way to detect the soft line break since I haven't tried it yet. But IMHO, since the long text is automatically wrapped, so the soft line break might be detected based on the current position of the caret. If the new curent position while the user is typing is set back to 0, then perhaps a soft line break is added. If the new position is not reset, you can compare the value with the cols property of the textarea to check if there is a soft line break. Just an idea.
|
|
|
|
|
Thank you very much for your reply.
Can you tell me how I can get the current cursor position ( Not the mouse cursor position) in the textarea? I tried but cannot find it in the document tree.
|
|
|
|
|
Hi,
actually, all you need to do is to change the default overflow handling of the textarea control to "visible", like this:
<textarea id="textArea" style="overflow:visible"></textarea>
--
Regards,
Dag
|
|
|
|
|
hello , i wana have ado with javascript but i have some problems , help me with one simple sample that connect Access file to ado and that's all !!
Have good day and time
|
|
|
|
|
|
How do I set focus to server controls created dynamically:-
Code to create controls:-
TextBox textBoxInput = new TextBox();
// Set the Textbox Text and Id Properties
textBoxInput.Text = fieldDefault;
textBoxInput.ID = "textBoxInput" + rowCount.ToString();
textBoxInput.MaxLength = fieldLength;
textBoxPH1.Controls.Add(textBoxInput);
// Add a spacer in the form of an HTML element
textBoxPH1.Controls.Add(new LiteralControl(" "));
How do I set focus to these textboxes
Clueless
|
|
|
|
|
Hi there,
You need to emit a snippet of client side script to set focus on the textbox:
string script = "<script type='text/javascript'>
document.getElementById('" + textBoxInput.ClientID + "').focus();</script>";
Page.RegisterStartupScript("setFocus", script);
|
|
|
|
|
I tried this and it doesn't compile textBoxInput isn't a variable, it's created dynamically.
|
|
|
|
|
When do you want to set focus on the textbox?
+ You can place the above sample code right after your code to dynamically create the textbox.
+ You can place the above sample code in a web page, and you need to get reference to the dynamic textbox first. You can use the container of the textbox and call the FindControl method.
|
|
|
|
|
Helllo
I am using a datagrid in a web application(.NET). When an user clicks the grid I want an menu to appear, (something like windows right click). I was thinking of creating the menu and all the functionallity in VB 6.0 ActiveX, and importing the ocx into the web app and using it there...
Will this work?
Is there an better way to solwe this problem?
Spaz
|
|
|
|
|
Hi,
there are tons of options available that won't require the use of an ActiveX. ActiveX objects are dangerous and modern browsers, even IE, do not allow them to execute unless the client grants the rights to the domain. In many corporate environments end users will not be able to grant such rights.
However, an ActiveX is entirely unnecessary for this purpose, DHTML has sufficient features to implement a custom context menu. If you only need to support Internet Explorer, a simple alternative is to use the popup object; check out a sample of a custom context menu here.
--
Regards,
Dag
|
|
|
|
|
i have a vc project in which i call the function in a script file(test.cfg), it's a jscript file, now i met a problem, so i wanna debug the script file, but i don't know how to do this, i add debugger in the file, but it doesn't work. can anyone help me?thanks in advance
|
|
|
|
|
I seem to recall putting lots of message boxes to screen when I needed to debug script files.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi, Christian Graus, thanks for yor reply.
how could i pop up a message dialog in jscript? which function should i call?
by the way i call the script function in this way. this might be in another thread or process, are u sure popup message dialog works in this case?
CComPtr<iactivescript> spScript;
.....
CComDispatchDriver spDisp;
spScript->GetScriptDispatch(scriptfilename, &spDisp);
spDisp.Invoke1(L"fun1", &v);
|
|
|
|
|
HeartFriend wrote:
how could i pop up a message dialog in jscript? which function should i call?
From memory, it's alert("message");
HeartFriend wrote:
this might be in another thread or process, are u sure popup message dialog works in this case?
No, I'm not.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Does anybody knows about Image Resizing Utility or Custom Tag for Cold Fusion ?
Or maybe some hints how to handle with this task ?
By The Way .. If exists free sources of C++/Java Image Resizing Utilities - they are also welcome !
Main processing formats - Jpeg (Gif)
Better Free of course ...
Thanks in advance !
|
|
|
|
|
|
Hi,
I'm developing an applicatio in C#(web) and I need to build some Graphs, this application is used to monitor traffic, in a ISP Link, I would like to know what's is the best, easiest and free tool to use it ?
Nowadays, it's in perl using rrdTool, and they want a new automatized application to do it !
-----------------------------
Visite: http://zopostyle.com
|
|
|
|
|
zopostyle wrote:
the best, easiest and free tool to use it ?
These are competing objectives. The best tool is probably not free.
I seem to recall there's a library for doing graphs in C# on this site though, have you looked ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Something like make settings after the AMBIENT_CONTROL event, but IE just can't fire that for me.
To edit the registry maybe one approach, but the response is bad
Thanks in advance!
|
|
|
|
|
Hi!
I have a web page that has a drop-down menu. Right below it is a Flash file. I don't want to take space for my sub-menus; instead, it'll show above the Flash. How can i do that? I have tried to set the z-index of both Flash and tags hold the Flash (such as p tag, div tag) but it doesn't work
Thanks!
|
|
|
|
|
Hello
Is it possible to implement a drag and drop method between two UltraWebGrids(Infragistics.WebUI.UltraWebGrid.v5.2) in Infragistics.
If anybody has done this, could you help me with a code example
Spaz
|
|
|
|
|
Hi Codeproject Members.
My wife is starting an eCommerce Web business and needs an out-of-the box solution to provide site portal. I am currently a software developer but do not have enough spare time to start this project from scratch.
I have investigated a few solutions that are on the market but the majority only allow minor changes to their templates which are hosted only on their sites.
I would like something that is recommended and is as near to native HTML as possible. ASP.NET would be OK. I can host the site so no problems there.
We would want to add links/pages and change Meta Data.
Any suggestions would be appreciated.
Regards Paul.;);)
|
|
|
|