Hi,

Does anyone know how to populate the maxlength property of an asp:textbox on page load?

I'm getting the value from the my config table in my DB

When I try setting myControl.MaxLength=10 in the onload event
It's not written to the control and when I enter text I'm not restricted at all

I've also tried

VB Code:
  1. <asp:textbox id="Abstract" Runat="server" Wrap="True" Rows="11" Columns="45" TextMode="MultiLine" maxlength="[HL="#FFFF00"]<%=SummaryLimit%>[/HL]"></asp:textbox>
  2.  
  3. ' And
  4.  
  5. <asp:textbox id="Abstract" Runat="server" Wrap="True" Rows="11" Columns="45" TextMode="MultiLine" maxlength="[HL="#FFFF00"]<%=Convert.ToInt32(SummaryLimit)%>[/HL]"></asp:textbox>
Geting error - <%=SummaryLimit%> is not a valid value for Int32.
And
<%=Convert.ToInt32(SummaryLimit)%> is not a valid value for Int32.

SummaryLimit Value is declared and assigned as an Int32
VB Code:
  1. Dim m_iSummaryLimit As Int32 = 250
  2.  
  3. Public Property SummaryLimit() As Int32
  4.         Get
  5.             Return Convert.ToInt32(m_iSummaryLimit)
  6.         End Get
  7.         Set(ByVal Value As Int32)
  8.             m_iSummaryLimit = Convert.ToInt32(Value)
  9.         End Set
  10. End Property