Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It sounds to me like you want to use the ItemDataBound event.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater.itemdatabound.aspx</a></p> <p>You will want to check the ItemType of the RepeaterItem so that you don't attempt to find the checkbox in Header/Footer/Seperator/Pager/Edit </p> <p>Your event would look something along the lines of:</p> <pre><code>void rptItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var checkBox = (CheckBox) e.Item.FindControl("ckbActive"); //Do something with your checkbox... checkBox.Checked = true; } } </code></pre> <p>This event can be raised by adding the event in your code behind like so:</p> <pre><code>rptItems.ItemDataBound += new RepeaterItemEventHandler(rptItems_ItemDataBound); </code></pre> <p>Or by adding it to the control on the client:</p> <pre><code>onitemdatabound="rptItems_ItemDataBound" </code></pre> <hr> <p>Alternatively you can do as the others suggested and iterate over the RepeaterItems, however you still need to check the itemtype.</p> <pre><code>foreach (RepeaterItem item in rptItems.Items) { if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem) { var checkBox = (CheckBox)item.FindControl("ckbActive"); //Do something with your checkbox... checkBox.Checked = true; } } </code></pre> <p>You would want to do that in the <strong>Page PreRender</strong>, after the Repeater has been bound.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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