Note that there are some explanatory texts on larger screens.

plurals
  1. POChanging Readonly attribute of Textbox within a repeater
    primarykey
    data
    text
    <p>On my aspx page i have a repeater with 5 textboxes with 1 imagebutton to edit the row these textboxes are readonly, to edit them I need them to not be readOnly..</p> <p>In my behind code i am using :</p> <pre><code>protected void EditRecipeInfo(object sender, CommandEventArgs e) { ImageButton ib = sender as ImageButton; TextBox titleTXT = (TextBox)ib.FindControl("titleRepeat"); TextBox qtyTXT = (TextBox)ib.FindControl("qtyRepeat"); TextBox uomTXT = (TextBox)ib.FindControl("uomRepeat"); TextBox prepTXT = (TextBox)ib.FindControl("prepRepeat"); TextBox orTXT = (TextBox)ib.FindControl("orRepeat"); titleTXT.ReadOnly = false; qtyTXT.ReadOnly = false; uomTXT.ReadOnly = false; prepTXT.ReadOnly = false; orTXT.ReadOnly = false; //// } </code></pre> <p>But when I fire this event the break points show me that the property is being set to false, but when I click to delete any value in the textbox it still acts like a readonly</p> <p><strong>UPDATE:</strong></p> <pre class="lang-xml prettyprint-override"><code> &lt;asp:Repeater ID="ingredRepeater" runat="server"&gt; &lt;HeaderTemplate&gt; &lt;table style="width: 100%"&gt; &lt;tr&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;h2&gt;Title&lt;/h2&gt;&lt;/th&gt; &lt;th&gt;&lt;h2&gt;Qty.&lt;/h2&gt;&lt;/th&gt; &lt;th&gt;&lt;h2&gt;UoM&lt;/h2&gt;&lt;/th&gt; &lt;th&gt;&lt;h2&gt;Prep.&lt;/h2&gt;&lt;/th&gt; &lt;th&gt;&lt;h2&gt;Alternate&lt;/h2&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:ImageButton Style="height: 25px; width: 25px;" ImageUrl="/img/edit.png" Visible="true" ID="editRecipeInfo" AutoPostBack="true" runat="server" OnCommand="EditRecipeInfo" CommandName='&lt;%# DataBinder.Eval(Container, "DataItem.DetailID") %&gt;' /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:ImageButton ImageUrl="/img/RedX.png" ID="button2" runat="server" Height="20" Width="20" CommandName='&lt;%# DataBinder.Eval(Container, "DataItem.DetailID") %&gt;' OnCommand="deleteRecipeView" /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox AutoPostBack="true" ReadOnly="true" ID="titleRepeat" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.Name") %&gt;' size="45" /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox AutoPostBack="true" ReadOnly='true' ID="qtyRepeat" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.Quantity") %&gt;' size="10" /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox AutoPostBack="true" ReadOnly='true' ID="uomRepeat" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.UnitsOfMeasure") %&gt;' size="10" /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox AutoPostBack="true" ReadOnly='true' ID="prepRepeat" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.Prep") %&gt;' size="10" /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox AutoPostBack="true" ReadOnly='true' ID="orRepeat" runat="server" Text='&lt;%# DataBinder.Eval(Container, "DataItem.AlternativeIngredients") %&gt;' size="20" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/table&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; </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.
 

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