Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2006-10-31
4
Medium Priority
?
2,072 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
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 1000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

783 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