Web.zipI am working on the module that does upload data, without storing file on the server, in the WebForm environment utilizing WebUpload control. In general it is working..
Have several questions:1.I am getting texts on the buttons as following : after load I see "Upload File" then "Upload" and after it done - "Add" .... How do I change text on them ?
2. I added <div id="uploadErrors" style="color: red;"></div> and <AllowedExtensions>, when I am trying to add file with wrong extension it does not show upload button but it does not show error message in red either.. How to make message visible
3. How to make Clear Upload button visible.
4. In the document on the site there is following example adding server events :
<system.web><pages><add tagPrefix="igjq" namespace="Infragistics.Web.UI.EditorControls"assembly="Infragistics.Web.jQuery"/></pages></system.web><igjq:WebUpload ID="webUpload1" runat="server"OnUploadFinishing="webUpload1_OnUploadFinishing"OnUploadFinished="webUpload1_OnUploadFinished"OnUploadStarting="webUpload1_OnUploadStarting"></igjq:WebUpload>
On the other hand I just added protected void WebUpload1_UploadFinishing(object sender, Infragistics.Web.UI.EditorControls.UploadFinishingEventArgs e) and it is working, what is the difference ?
Files added for references, please show fixes in FileUpload01when possible...
Hello Michael,
After investigating this further, I determined that the labels of the buttons could be customized by using the Locales-LabelUploadButton, Locales-LabelAddButton and Locales-LabelSummaryProgressButtonContinue properties of the WebUpload:
<ig:WebUpload ID="WebUpload1" runat="server . . . Locales-LabelUploadButton="myUpload" Locales-LabelAddButton="myAdd" Locales-LabelSummaryProgressButtonContinue="myUploadStart">
The clear button could be displayed by setting the mode of the WebUpload to multiple. Additionally if the WebUpload should allow only one image, MaxUploadedFiles property could be set to 1.
Regarding your second requirement, a method could be bound to the onError client side event, where the innerHtml of the div could be set to the error message. The method would look as follows:
var div = document.getElementById("uploadErrors");
function error(sender, args) {
div.innerHTML = args.errorMessage;
}
In regards to the WebUpload events our sample implements handlers for both OnUploadStarting, OnUploadFinishing and OnUploadFinished. They are implemented for the purposes of this particular sample, however it is not necessary to always include them in order to have your WebUpload control working. In case that you need one or more of them the essential part is to have them included in the tag for the web upload and to have handlers on the server side. By default, handler names are created as following: ControlID_EventName. For example: webUpload1_OnUploadFinishing However, if you would like to change this name you can assign any name of your choice, as I believe is the case with WebUpload1_UploadFinishing.
Below I am attaching a sample, demonstrating customizing the labels. Please test it on your side and let me know if you need any further information regarding this matter.
Regards, Monika Kirkova, Infragistics
WebUploadSaveFile.zip
Hi Monika,
Thanks for the help, It is still work in progress.. I have another issue that I need to resolve, It is somehow related to the way control operates.. After I've read the stream ( string xmlDt = impOS.ReadLR4OneSourceSpreadsheet(e.FileStream); ) I do some data save and then has to seamlessly transfer to other page that does processing and representation.. The upload control while sending file to the server does not cause page to postback... so there is seems like no lifecycle page events where I can put Server.Transfer request and naturally if I would put it into UploadFinishing event like below I will get {"Error executing child request for Uno.aspx."}, because it is apparently wrong context.. Would you advise how to deal with transfer in the WebForm environment while using this control for Upload.. The transfer is needed right after file read in the UploadFinishing event..
protected void WebUpload1_UploadFinishing(object sender
, nfragistics.Web.UI.EditorControls.UploadFinishingEventArgs e) { LR4OneSourceImport impOS = new LR4OneSourceImport(); string xmlDt = impOS.ReadLR4OneSourceSpreadsheet(e.FileStream); // e.Cancel = true; Server.Transfer("Uno.aspx", true); }
Thanks.