Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I will probably do it from markup itself - this is assuming that you have "IsDefault" column/property of bit/boolean type in your data-source indicating the address is default. So use following markup:</p> <pre><code>... &lt;tr&gt; &lt;td&gt; &lt;asp:LinkButton ID="lnk1" Text="Make Default" CommandName="SetDefault" runat="server" Visible='&lt;%# !Eval("IsDefault") %&gt;' CommandArgument='&lt;%#Eval("UserID") %&gt;' CausesValidation="false"&gt;&lt;/asp:LinkButton&gt; &lt;asp:Label ID="label1" Text="Yes" runat="server" Visible='&lt;%# !Eval("IsDefault") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; ... </code></pre> <p>You need to control visibility based on property in your data source (either using markup or ItemDataBound event). Also when SetDefault link is clicked, you must either re-bind the repeater new state or toggle visibility explicitly (as your current code is doing).</p> <p>EDIT: If data binding expression are not working then you have to do it in ItemDataBound event. I see that you have already tried that but there is one mistake - <code>bllUsers obj=new bllUsers();</code> will always have IsDefault as false - you need to use data item. For example,</p> <pre><code>protected void myRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { bllUsers obj = e.Item.DataItem as bllUsers; ((Label)e.Item.FindControl("ldefault")).Visible = obj.isDefault; ((Button)e.Item.FindControl("btnMakeDefault")).Visible = ! obj.isDefault; } } </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