How to upload files with Ms Web controls!

Source: Internet
Author: User
Currently, this problem occurs. before uploading a file, you must set the permissions of the file. The upload progress bar must appear during file upload. Therefore, the file upload steps can only be placed in the last step. In this way, the file download right cannot be set first. My previous solutions are:

1. Select the path to save the uploaded file;
2. Select Upload File;
3. start uploading files and display the upload progress bar;
4. Set the permission to download uploaded files.
5. Complete.

This step looks reasonable, but there is a small problem in the middle: for large file uploads, steps 3rd and 4th may have to wait for a long time. In this way, the boss asked to re-select the order.

1. Select the path to save the uploaded file;
2. Select files;
3. Select the user to download the file, that is, set the download permission;
4. Start upload and display the upload progress bar;
5. display the completion information.

This is a headache. Once a file is selected, the next action must upload the file. Otherwise, all callback operations will lead to file upload tasks, even if you do not display the upload progress bar, it will take a long time. I have asked for help in Google's blog, but there is no good solution to this problem. The only feasible solution is to use js to perform a large number of operations on the client.

Coincidentally, the MS blog was opened yesterday, so I applied for one. It is found that its information is updated in a page, and only the last commit is used for data updates. Others are done locally. This reminds us of using the multipage in MS Web controls to do this.

This set of components can be downloaded from the MS website, and its usage instructions are also available on msdn. However, there is not much to say about multipage. In particular, the dynamic addition page does not exist. I had to do it myself.

However, vs. net2003's support for this component is not perfect. The most depressing thing is to add a viewpage in multipage.CodeMode. The design view cannot be used. Find a solution, first make the content out of multipage, and then cut it into multipage. What's depressing is that all events are gone! You have to manually add... Depressed...

The whole design process is not difficult, but the most depressing thing is to add the user's download permission. Because the server function cannot be called back, all the functions must be completed on the client.


The most depressing thing here is that the user/client and startdate and enddate data are added to the client using JS, and after the file is uploaded, the data here cannot be obtained on the server side ......

For this reason, I gave up the last time I prepared such a solution.
However, you have to do this now. What should I do ??? Think of a way: hide a text box, add data, and restore the data. The JS Code is a lot:

Function Addnewuser (o_objusername, I _objusername, o_objstartdate, I _objstartdate, region, I _objenddate, h_objuserid, h_objstartdate, h_objenddate, h_objusernames)
{
// Window. Status = "click the button .";
// O_objusername: dropdown list
// O_objenddate, o_objstartdate: Text Box
// I _objusername, I _objenddate, I _startdate: list box
O_objusername = Eval ( " Document. All. " + O_objusername );
O_objstartdate = Eval ( " Document. All. " + O_objstartdate );
O_objenddate = Eval ( " Document. All. " + O_objenddate );
I _objusername = Eval ( " Document. All. " + I _objusername );
I _objstartdate = Eval ( " Document. All. " + I _objstartdate );
I _objenddate = Eval ( " Document. All. " + I _objenddate );
H_userid = Eval ( " Document. All. " + H_objuserid );
H_startdate = Eval ( " Document. All. " + H_objstartdate );
H_enddate = Eval ( " Document. All. " + H_objenddate );
H_username = Eval ( " Document. All. " + H_objusernames );
// If (o_objstartdate.value = "" | o_objenddate.value = "") return;
// Window. Status = o_objstartdate.value;
VaR M_namevalue = O_objusername.options [o_objusername.selectedindex]. value;
If (M_namevalue = " -1 " | M_namevalue = " 0 " ) Return ;
VaR M_nametext = O_objusername.options [o_objusername.selectedindex]. text;
VaR M_startdate = O_objstartdate.value;
VaR M_enddate = O_objenddate.value;
VaR M_optionname =   New Option (m_nametext, m_namevalue, False , False );
VaR M_optionstart =   New Option (m_startdate, m_startdate, False , False );
VaR M_optionend =   New Option (m_enddate, m_enddate, False , False );
I _objusername.options [I _objusername.length] = M_optionname;
I _objstartdate.options [I _objstartdate.length] = M_optionstart;
I _objenddate.options [I _objenddate.length] = M_optionend;
I _objusername.size = I _objusername.length + 1 ;
I _objstartdate.size = I _objstartdate.length + 1 ;
I _objenddate.size = I _objenddate.length + 1 ;
// Set hiden data
H_userid.value + = M_namevalue + " | " ;
H_startdate.value + = M_startdate + " | " ;
H_enddate.value + = M_enddate + " | " ;
H_username.value + = M_nametext + " | " ;

}

On the server, to restore data: Create userids # Region Create userids
String [] M_userids =   This . Textbox_userid.text.split ( ' | ' );
String [] M_startdate =   This . Textbox_startdata.text.split ( ' | ' );
String [] M_enddate =   This . Textbox_enddate.text.split ( ' | ' );
String [] M_usernames =   This . Textbox_usernames.text.split ( ' | ' );
Long M_clientid = ( This . Page As Basepage). Visitor. userid;
# Endregion

This is not safe, but it cannot be done. Let's do it first.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.