Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding to Textbox Maxlength field within repeater
    primarykey
    data
    text
    <p>Ive got an issue where the MaxLength field doesnt seem to adhere to the value being set in code-behind.</p> <pre><code>MaxLength='&lt;%#Convert.ToInt32(Eval("AdditionalOptionInfo.MaxFieldLength"))%&gt;' </code></pre> <p>If I set the MaxLength="10" for example it seems to work fine. </p> <p>EDIT: Whole code</p> <pre><code>&lt;asp:Repeater ID="rptList" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;ul&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;li&gt; &lt;div class="asdf"&gt; &lt;asp:LinkButton ID="adsf" CssClass="asdf" CommandArgument='&lt;%#Eval("OptionAvailable")%&gt;' runat="server" OnDataBinding="lnkList_OnDataBinding" OnClientClick="contactDetailOptionClick(this); return false;"&gt; &lt;%#Eval("DisplayText")%&gt; &lt;table class="tbox" runat="server" visible='&lt;%#Eval("IsAdditionalInfoApplicable")%&gt;'&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label runat="server" CssClass="asdf" Text='&lt;%#Eval("AdditionalOptionInfo.InstructionText")%&gt;' /&gt; &lt;br /&gt; &lt;asp:TextBox placeholder='&lt;%#Eval("AdditionalOptionInfo.PlaceHolderText")%&gt;' RetainValueAfterPostback="true" ellipsis="true" AutoComplete="Off" runat="server" MaxLength='&lt;%#Convert.ToInt32(Eval("AdditionalOptionInfo.MaxFieldLength"))%&gt;' /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/asp:LinkButton&gt; &lt;/div&gt; &lt;/li&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/ul&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>My implementation after Andrew's suggestion:</p> <pre><code>public int GetMaxLength(object additionalOptionInfo) { var option = additionalOptionInfo as TypeXYZ&lt;string&gt;; return option != null ? option.MaxFieldLength : 0; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload