johna
johna

Reputation: 10752

ASP.NET Repeater inside UpdatePanel, need to create PostBackTrigger

I have an UpdatePanel which has a Repeater inside it, and inside of the Repeater is a Button that I want to be a PostBackTrigger for the UpdatePanel (not an AsyncPostBackTrigger).

I have tried to create a trigger in the code behind in the Repeater's ItemDataBound event (using code below) but nothing I tried worked.

PostBackTrigger trigger = new PostBackTrigger();
//failed
//trigger.ControlID = "btnCourseAttachmentUpdateSubmit";
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).ID;
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).ClientID;
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).UniqueID;
panAttachments.Triggers.Add(trigger);

I know there is a technique to resolve this by using a hidden button but before I did that I wondered if there was a way of doing this similar to what I was trying in the code above?

Upvotes: 4

Views: 2790

Answers (1)

Sunil Chavan
Sunil Chavan

Reputation: 524

ScriptManager.RegisterPostBackControl(e.Item.FindControl("btnCourseAttachmentUpd‌​ateSubmit"));

Upvotes: 3

Related Questions