rad 上傳空間二次開發指導書

來源:互聯網
上載者:User

標籤:c#   asp.net   rad控制項   上傳控制項   

1 適用範圍
本組件rad組件包的組件,支援.NET Framework 1.1 和 2.0,B/S架構的應用系統。
支援IE、FireFox等多種瀏覽器。

2 控制項功能
 點擊有上傳進度條上傳
  
 
優點:
1 有ajax的上傳即時進度條。對大檔案上傳
2 對上傳檔案的大小、種類、上傳後的目錄儲存都封裝好了,配製幾個屬性就行
2.1 高度封裝
結構比較簡單,已經封裝

2.2 使用方法
1 首先安 as裝r.a.d UPLOAD 控制項,或者安裝整個r.a.d control包
2 在開發環境引用這個組件 RadUpload.Net.dll
 3 可以直接在工具列裡往介面拖了
 
 最簡單的使用
<%@ Register TagPrefix="radU" Namespace="Telerik.WebControls" Assembly="RadUpload.Net2" %>
1. 
<radU:RadUpload ID="upload1" Runat="server">
</radU:RadUpload>

2.3 要點
1 上傳大檔案,可以在system.web裡配置
<configuration>
<system.web>
    <httpRuntime maxRequestLength="10000" />
  </system.web>
</configuration>

3 上傳進度條
<radu:radupload id="RadUpload1" runat="server" />
<radu:radprogressarea id="RadProgressArea1" runat="server" />
<radu:radprogressmanager id="RadProgressManager1" runat="server" />
<asp:button id="Button1" runat="server" text="Submit" />

private void LooongMethodWhichUpdatesTheProgressContext(UploadedFile file)
{
   const int total = 100;

   RadProgressContext progress = RadProgressContext.Current;
   for (int i=0; i<total; i++)
   {
      progress["SecondaryTotal"] = total.ToString();
      progress["SecondaryValue"] = i.ToString();
      progress["SecondaryPercent"] = i.ToString();
      progress["CurrentOperationText"] = file.GetName() + " is being processed...";

      if (!Response.IsClientConnected)
      {
          //Cancel button was clicked or the browser was closed, so stop processing
          break;
      }

      //Stall the current thread for 0.1 seconds
      System.Threading.Thread.Sleep(100);
   }
}

private void Button1_Click(object sender, System.EventArgs e)
{
   UploadedFile file = RadUploadContext.Current.UploadedFiles[File1.UniqueID];
   if (file != null)
   {
      LooongMethodWhichUpdatesTheProgressContext(file);
   }
}

protected void Page_Load(Object sender, System.EventArgs e)
{
   if (!IsPostBack)
   {
      //Do not display SelectedFilesCount progress indicator.
      RadProgressArea1.ProgressIndicators = ProgressIndicators.CurrentFileName |
         ProgressIndicators.FilesCount |
         ProgressIndicators.FilesCountBar |
         ProgressIndicators.FilesCountPercent |
         ProgressIndicators.RequestSize |
         ProgressIndicators.TimeElapsed |
         ProgressIndicators.TimeEstimated |
         ProgressIndicators.TotalProgress |
         ProgressIndicators.TotalProgressBar |
         ProgressIndicators.TotalProgressPercent |
         ProgressIndicators.TransferSpeed;

      RadProgressArea1.Localization["UploadedFiles"] = "Processed ";
      RadProgressArea1.Localization["TotalFiles"] = "";
      RadProgressArea1.Localization["CurrentFileName"] = "File: ";

      RadProgressContext progress = RadProgressContext.Current;
      //Prevent the secondary progress from appearing when the file is uploaded (FileCount etc.)
      progress["SecondaryTotal"] = "0";
      progress["SecondaryValue"] = "0";
      progress["SecondaryPercent"] = "0";
   }
}
自訂進度條
<radu:radprogressarea runat="server" id="RadProgressArea1" skin="Vista"
    progressindicators="FilesCount,FilesCountBar,FilesCountPercent" />

 
4 控制項使用說明
安裝r.a.d control 安裝包後,查看組件的詳細使用協助
5 待改進的方面
 

參考1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

rad 上傳空間二次開發指導書

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.