Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET CSS Visual-Studio , +
I added a multiline textbox to gridview in my website project in c# Asp.net. I will retrieve text from database to my textbox.
 
I set the width and height of texbox to 100% and put it in a div. But when I view the site in browser doesnt fill the div and it is resizeable. I also set the height and width of div to 100% in my .css file.
 
How can I fill the div with textbox and lock the size of textbox?
Posted 23-Sep-12 4:20am
Edited 23-Sep-12 4:47am
v3
Comments
Sandeep Mewara at 23-Sep-12 9:37am
   
Not clear.
Pooya F.A at 23-Sep-12 9:42am
   
I want to stop the user from increasing the height or width of textbox.
Sergey Alexandrovich Kryukov at 23-Sep-12 11:13am
   
The basic problem seems to be clear, but some detail would be needed. Could you write a simple sample with just one text box to reproduce the problem. As it is only related to HTML (and probably CSS), not ASP.NET, it would be good if this is pure HTML code.
--SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

In C#:
<asp:textbox id="txtComments" runat="server" bordercolor="Gray" xmlns:asp="#unknown">
           BorderStyle="Solid" BorderWidth="1px" CausesValidation="true" Wrap="true"
           MaxLength="100"
           TextMode="MultiLine" 
           Width="350px"></asp:textbox>
 
in aspx.cs
 public int MaxLength
    {
        get { return txtComments.MaxLength; }
        set { txtComments.MaxLength = value; }
    }
    public void wordCount()
    {
        txtCount.Text = txtComments.MaxLength.ToString();
        txtComments.Attributes.Add("onKeyUp", "javascript:document.getElementById('" + txtCount.ClientID + "').setAttribute('value', (" + txtComments.MaxLength + " - parseInt(document.getElementById('" + txtComments.ClientID + "').getAttribute('value').length)));");
  
    }
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 480
1 Maciej Los 304
2 Richard MacCutchan 225
3 BillWoodruff 169
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,759
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,269
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411028.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100