Hello. I am dynamically adding multiple upload controls - I need to find a way to pass an argument to the OnClientFileUploaded javascript function OR to dynamically create the function itself from the code behind so that I can build the argument directly into the OnClientFileUploaded function.
Specifically, I need to pass an ID to the function so that when the files are uploaded, I can tell where they should be saved. Please note this is not the controlID but an ID from my database.
I've tried adding the function code like this, but the timing does not seem to be correct. Thank you for any help on this!
protected
void
Page_Load(
object
sender, EventArgs e)
{
StringBuilder sb =
new
StringBuilder();
sb.Append(
"<script> function OnClientFileUploaded(sender) {\n"
);
sb.Append(
"<%= Page.ClientScript.GetPostBackEventReference(new PostBackOptions(this,"
).Append(tempContentID).Append(
")) %>\n"
);
sb.Append(
"}</script>"
);
this
.Page.ClientScript.RegisterClientScriptBlock(
typeof
(RadEditor),
"UploadScript_"
+
this
.ClientID, sb.ToString());
}
protected
void
Page_PreRender(
object
sender, EventArgs e)
{
RadAsyncUpload1.OnClientFileUploaded =
"OnClientFileUploaded"
;
}