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 Sergey Alexandrovich Kryukov 504
1 Maciej Los 349
2 Kornfeld Eliyahu Peter 325
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,303
1 DamithSL 4,764
2 Maciej Los 4,306
3 Kornfeld Eliyahu Peter 3,914
4 Sergey Alexandrovich Kryukov 3,538


Advertise | Privacy | Mobile
Web03 | 2.8.141220.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