Solved

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

Posted on 2006-10-31
4
1,888 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
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
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
Comment Utility
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
Comment Utility
Short snippet:

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

Bob
0
 

Author Comment

by:cgipisani
Comment Utility
This worked after putting that code inside of <asp:TemplateField>

Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

743 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

12 Experts available now in Live!

Get 1:1 Help Now