Solved

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

Posted on 2014-09-30
2
171 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
2 Comments
 

Accepted Solution

by:
draek earned 250 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 250 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now