protected void UploadButton_Click(object sender, EventArgs e) { try { if (!DataControlFileUpload.HasFile) { ShowMessage("请先选择一个控件数据包文件(.zip)。"); } else { string fn = DataControlFileUpload.FileName; if (String.Compare(Path.GetExtension(fn), ".zip", true) != 0) { ShowMessage("控件数据包文件必须是zip文件。"); } else { Uploader.FileName = Path.GetTempFileName() + ".zip"; DataControlFileUpload.SaveAs(Uploader.FileName); Uploader.Process(Path.GetFileNameWithoutExtension(fn)); DataControlsGridView.DataSource = Uploader.Templates; DataControlsGridView.DataBind(); ReviewPanel.Visible = true; UploadPanel.Visible = false; } } } catch (Exception ex) { HandleException(ex); } }
protected override void Initialize() { DataControlsGridView.DataSource = TemplateHelper.GetDataControls(null); DataControlsGridView.DataBind(); }