Geeks With Blogs
Jonas Bush

I was working on some sample stuff that I'll be posting later and ran into a problem. I had 2 different update panels; inside one was just a div, inside the other one was a repeater. Inside the repeater I had a bunch of checkboxes, and when I checked/unchecked them, I needed the first update panel to be updated. This posed a couple of problems:

  • A checkbox doesn't have a CommandName property, and can't be used to trigger a Repeater's ItemCommand event

This I got around by declaring the event handler for the checkbox in the markup: OnCheckedChanged=”myCB_OnCheckedChanged”, and in the event handler I can cast the sender argument to a checkbox. The other problem:

  • An UpdatePanel's list of triggers can't include a control that's inside a template

Which means I can't say <atlas:ControlEventTrigger ControlID=”myCB” EventName=”myCB_OnCheckedChanged” />, since myCB doesn't actually exist at runtime. Instead, in myCB_OnCheckedChanged, I can just say: updatePanel1.Update(); and everything works fine.

Hope this helps...

Posted on Monday, May 8, 2006 2:08 PM Atlas , ASP.Net | Back to top

Comments on this post: Repeaters, Checkboxes and UpdatePanels, Oh My!

# re: Repeaters, Checkboxes and UpdatePanels, Oh My!
Requesting Gravatar...
Hi Jonas,

I'm trying more or less the same but with a normal button to trigger the ItemCommandEvent.

When i surround my display area with an updatepanel i can't seem to get rid of the postbacks

this is how i declared my repeater:

<asp:Repeater ID="repMain" runat="server" OnItemCommand="repMain_ItemCommand" OnItemDataBound="repMain_ItemDataBound">
<asp:Button ID="btnStatus" runat="server" Text="GO" OnClick="up1.Update();" CommandName="Display" CommandArgument="<%# Container.DataItem %>"/>
<%# Container.DataItem %>
Left by Wesley Van den Eede on May 18, 2006 5:24 AM

# re: Repeaters, Checkboxes and UpdatePanels, Oh My!
Requesting Gravatar...

Without seeing the markup for your UpdatePanel and your ScriptManager, I'm not quite sure what's not working...could you post those?
Left by Jonas on May 18, 2006 7:30 PM

# re: Repeaters, Checkboxes and UpdatePanels, Oh My!
Requesting Gravatar...
Hola lo que debes hacer es en el codigo del itemdatabound del repeater el siguiente codigo por ej.

protected void RepeatEntidades_ItemDataBound(object sender, RepeaterItemEventArgs e)
if (e.Item.ItemType != ListItemType.Item) return;

CheckBox chk = (CheckBox)e.Item.FindControl("CheckBox1");
if (chk == null) return;


ahi lo que haces es que cada vez que enlazas un item al repeater lo matriculas como control para realizar un postback asincronico. a mi me funciona perfecto, Saludos.
Left by Sergio Gonzalez on Dec 15, 2008 8:36 AM

Your comment:
 (will show your gravatar)

Copyright © Jonas Bush | Powered by: