?
Solved

ASP.NET & C#: Modify the character limit of a textbox

Posted on 2014-09-30
2
Medium Priority
?
188 Views
Last Modified: 2014-10-02
Currently, a textbox is set to allow 50 characters. I need to limit it to 40 characters. None of my below attempts seem to be working:

I tried doing this in the ascx.cs file:
txtName1.MaxLength = 40;

I also tried doing this in the .ascx file:
<TD class="ControlLayoutCell"><cc1:i1textbox id="txtName1" tabIndex="2" runat="server" Text="" Width="100%" MaxLength="40"><LabelStyle CssClass="TextBoxEditDisabled"></LabelStyle>
													<TextBoxStyle CssClass="TextBoxGeneric"></TextBoxStyle>
												</cc1:i1textbox></TD>

Open in new window

0
Comment
Question by:pzozulka
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
draek earned 1000 total points
ID: 40354068
You are using a custom textBox class or something? I'm asking this because the default component will act as you like, so if you're doing textBox1.MaxLength will do the job.
0
 
LVL 32

Assisted Solution

by:Robberbaron (robr)
Robberbaron (robr) earned 1000 total points
ID: 40354098
yes, you need to provide more details about the custom control
i1Textbox
as i cant find any references to it elsewhere.
0

Featured Post

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question