Click here to Skip to main content
11,934,809 members (47,745 online)
Rate this:
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# 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
Sandeep Mewara 23-Sep-12 9:37am
Not clear.
Pooya F.A 23-Sep-12 9:42am
I want to stop the user from increasing the height or width of textbox.
Sergey Alexandrovich Kryukov 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.

1 solution

Rate this: bad
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"

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)));");

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 23 Sep 2012
Copyright © CodeProject, 1999-2015
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