Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Getting an asp.net TextBox to fill a screen and adjust heightdynamically

Reply
Thread Tools

Getting an asp.net TextBox to fill a screen and adjust heightdynamically

 
 
Terry
Guest
Posts: n/a
 
      02-20-2008
I am trying to figure out if there is a way to get a regular asp.net
TextBox to fill the screen, both height and width. When I drop a
TextBox onto a blank asp.net page and set the height="100%",
width="100", and the TextMode="MultiLine", the TextBox will fill the
width of the page, and will adjust the width dynamically as the page
changes size, but the height of the textbox is not full screen as I
would like. It remains at 2 lines high.

Is there a way to get the height of a textbox to fill the screen, and
adjust its size automatically when the screen size changes? Thanks.
 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      02-20-2008
Textbox height may only be adjusted on a row of input basis by setting the
Textmode property to Multi-line and then the Rows property to the desired
row amount. You cannot set a textbox's height in pixels or percent, as you
can do with other controls.


"Terry" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am trying to figure out if there is a way to get a regular asp.net
> TextBox to fill the screen, both height and width. When I drop a
> TextBox onto a blank asp.net page and set the height="100%",
> width="100", and the TextMode="MultiLine", the TextBox will fill the
> width of the page, and will adjust the width dynamically as the page
> changes size, but the height of the textbox is not full screen as I
> would like. It remains at 2 lines high.
>
> Is there a way to get the height of a textbox to fill the screen, and
> adjust its size automatically when the screen size changes? Thanks.



 
Reply With Quote
 
 
 
 
Terry
Guest
Posts: n/a
 
      02-20-2008
So does that mean it is not possible to set the TextBox height so that
it will be full screen, and automatically adjust when the page size is
changed?

Ultimately what I'm trying to do is create a page very similar to an e-
mail inbox page, with a grid on the top half of the screen, a splitter
bar, and a TextBox at the bottom that always fills the bottom half of
the page, even when the splitter bar is adjusted. I was hoping I
could do this with a TextBox on the bottom. Any suggestions?
 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      02-20-2008
trival:


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="FullTextBox.aspx.cs"
Inherits="FullTextBox" %>
<html>
<body style="margin:2px;border:0px;padding:0px;"
onresize="doResize();"
onload="doResize();"
>

<script>
function doResize(){
var txt1 = document.getElementById('<%=txt1.ClientID %>');
txt1.style.height=(document.body.clientHeight-6)+'px';
}
</script>
<form id="form1" runat="server">
<asp:textbox
id="txt1"
style="width:100%;margin:0px;border:1px black solid;padding:0px;"
runat="server"
TextMode="MultiLine"
/>
</form>
</body>
</html>


-- bruce (sqlwork.com)


"Terry" wrote:

> I am trying to figure out if there is a way to get a regular asp.net
> TextBox to fill the screen, both height and width. When I drop a
> TextBox onto a blank asp.net page and set the height="100%",
> width="100", and the TextMode="MultiLine", the TextBox will fill the
> width of the page, and will adjust the width dynamically as the page
> changes size, but the height of the textbox is not full screen as I
> would like. It remains at 2 lines high.
>
> Is there a way to get the height of a textbox to fill the screen, and
> adjust its size automatically when the screen size changes? Thanks.
>

 
Reply With Quote
 
Terry
Guest
Posts: n/a
 
      02-20-2008
Thanks Bruce! That that worked exactly as I had hoped.

I did find that the "onresize" event in the body element is not valid
for XHTML Transitional markup. I took out the DOCTYPE reference to
test your code, and it worked. I'll probably have to find a work-
around for the onresize event if I want my web page to enforce XHTML
Transitional.

Thanks again.
 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      02-20-2008
xhtml has no replacement (it just depicated, not removed), but its a valid
event for html 4.0/ 5.0/ xhtml2 (undepicated if htmlelement).


-- bruce (sqlwork.com)


"Terry" wrote:

> Thanks Bruce! That that worked exactly as I had hoped.
>
> I did find that the "onresize" event in the body element is not valid
> for XHTML Transitional markup. I took out the DOCTYPE reference to
> test your code, and it worked. I'll probably have to find a work-
> around for the onresize event if I want my web page to enforce XHTML
> Transitional.
>
> Thanks again.
>

 
Reply With Quote
 
Terry
Guest
Posts: n/a
 
      02-21-2008
Good additional info. Thanks Bruce!
 
Reply With Quote
 
s14raj s14raj is offline
Junior Member
Join Date: Nov 2011
Posts: 1
 
      11-16-2011
TextBox b=new TextBox ();
b.TextMode=TextBoxMode.MultiLine; // for Textmode
b.Width=200; //for Width
b.Height = 100; //for Height



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to adjust the screen Fred J Computer Support 1 10-16-2005 04:20 AM
How to adjust the screen Fred J Computer Information 0 10-16-2005 03:40 AM
Automatically adjust TextBox's height H. ASP .Net Web Controls 1 06-29-2005 06:31 PM
Fill TextBox with DataReader... Islam Elkhayat ASP .Net 2 11-22-2004 03:47 AM
Textbox onchange won't fire after fill-in from popup window? Kathy Burke ASP .Net 1 11-10-2003 08:46 PM



Advertisments