Solved

Is there a way to set MaxLength on a BoundField within a DetailsView control?

Posted on 2006-10-31
4
1,978 Views
Last Modified: 2010-05-19
Within a DetailsView control I have several BoundField controls.  When I am in edit or insert mode for the DetailsView control, a TextBox is created for each BoundField.  How can I set the MaxLength property for these TextBox's?
0
Comment
Question by:cgipisani
[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
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17849007
Instead of a BoundField, you could define a Template field, and hard code the TextBox with MaxLength set.  It might also be possible to get a reference to the TextBox from the BoundField, but that would be significantly more difficult.

Bob
0
 

Author Comment

by:cgipisani
ID: 17849067
How would the Template Field work?  Do you give the TextBox the DataField attribute that would be part of the BoundField?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17849089
Short snippet:

<EditItemTemplate>
    <asp:TextBox runat="server" ID="TextBox1" Text='<%# Bind("Field1") %>' />
<EditItemTemplate>

Bob
0
 

Author Comment

by:cgipisani
ID: 17849145
This worked after putting that code inside of <asp:TemplateField>

Thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

734 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