Frage

I'm currently trying to show a SheerResponse.YesNoCancel() dialog within the Save uiUpload pipeline process from Sitecore. The problem appears when I do that call and it throws a NullException. I thought it was weird so I started copying the code from Sitecore's DLL and adding it to my solution. After that, I found that if the property OutputEnable is false it returns a ClientCommand that is NULL and when it tries to add a control to it, the Exception appears. So Fixing that I was able to finish the execution of that method. Anyway I still can't show the dialog. So the question is: Can I show a Dialog from a Sitecore uiUpload pipeline?

War es hilfreich?

Lösung 2

No you cannot. From http://sdn.sitecore.net/Articles/Media/Prevent%20Files%20from%20Uploading.aspx:

The uiUpload pipeline is run not as part of the Sheer event, but as part of the form loading process in response to a post back. This is because the uploaded files are only available during the "real" post back, and not during a Sheer UI event. In this sense, the uiUpload pipeline has not been designed to provide UI.

That page was written for v5.1 and 5.2, but I'm pretty sure it still applies. The page claims that you can emit javascript to the page like Ahmed suggested, but it didn't work when I tried it.

Andere Tipps

Have you tried using Sitecore.Context.ClientPage.ClientResponse.YesNoCancel(), i did something similar to what you are trying to do, but i used Alert(), worked fine for me.

Update: Actually inside uiUpload pipeline you can't call this method, however what you can do is use HttpContext.Current.Response.Write("<html><head><script type=\"text/Javascript\">[Your Java Script</script></head></html>"), you will need to abort the pipeline after this args.AbortPipeline();, not sure if this will help your case or not

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top