I'm trying to display a warning dialogue if the filename length is too long within an AjaxFileUpload_UploadComplete method. I can easily do the logic to count characters but how am I supposed to display a warning dialogue or access the built in warning messages? I can't call a javascript dialogue or display a label since AJAX requests are performed independently of the ASP.NET page infrastructure, and any changes made to controls' state are not visible.
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
//Count characters in filename.
var filenameChars = e.FileName.ToString();
if (filenameChars.Length > 10)
{
ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "myFunction", "MyFunction();", true);
return;
}
}
In the example, the JavaScript dialogue does not appear and I have not way to display a warning..