AUTHOR: Peter Milchev
DATE POSTED: November 17, 2017
The PostbackTriggers collection can be modified in the Page_Init event of the page lifecycle. That would allow adding certain controls to the PostbackTriggers collection based on hidden field values or some other custom logic.
<
asp:HiddenField
runat
=
"server"
ID
"shouldSave"
/>
JavaScript:
function
updateHiddenField() {
var
hidden = document.getElementById(
"<%= shouldSave.UniqueID %>"
);
hidden.value =
"fixTriggers"
;
}
CodeBehind:
protected
void
Page_Init(
object
sender, EventArgs e)
{
if
(Request[shouldSave.UniqueID] !=
null
&& Request[shouldSave.UniqueID].ToString() ==
)
RadAsyncUpload1.PostbackTriggers =
new
string
[] {
"RadButton1"
};
else
// persist the files on all postbacks
""
RadAsyncUpload1_FileUploaded(
sender, FileUploadedEventArgs e)
shouldSave.Value =
Resources Buy Try