Avatar of ShopSetup
ShopSetup asked on

Adding programatically created controls as triggers for updatepanel.

I've been trying and I've been reading but I cannot make this thing work... Adding programmatically created controls as triggers for my updatepanel, sigh.

I have 2 repeaters that creates Headlines and Checkboxes that will later filter out a gridview.
The gridview is within a updatepanel, the repeaters are not.
The checkboxes are created based on data from my database.
The checkboxes CheckedChanged events are fired and the filtering begins.
Works great.

Now I want the gridview to update through a AsyncPostBack.
I've tried added this to both Checkbox_Init and repeater_ItemDataBound
        AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();
        trigger.ControlID = checkBox.UniqueID;

and I've tried this on both locations:

I have been reading and apparently you have to use the ScriptManager1.RegisterAsyncPostBackControl method to make this work but it just wont.

Any ideas?

Thanks for any help...
.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Is the ID of the update panel you mentioned in you solution the client id or the .net control id? I have a repeater that contains an update panel that contains another repeater. The button for the trigger is outside the panel. When the button is clicked it is supposed to populate the repeater inside the update panel. I implemented your solutions, but I get a javascript error "Object doesn't support this property or method."
Any help is appreciated. Thanks.

Hi Braalewi, sorry for not noticing your comment until now.

updPanel is the .net id of the <asp:UpdatePanel> control.

The button that updates the inner-repeater is inside the first repeater right? And that button is added at runtime?

Maybe you can post your code and I can have a look at it, since its a javascript error it somehow looks like the postback on the button is faulty. Is the button also added at runtime? Is the repeater added at runtime?


I ended up getting this working. Thanks for the reply.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes