ftb.imagegallery.aspx
上传用户:lishan0805
上传日期:2019-12-08
资源大小:12048k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. <%@ Page Language="C#" ValidateRequest=false Trace="false" %>
  2. <%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
  3. <script runat="server">
  4. protected void Page_Load(Object Src, EventArgs E) {
  5. // *** remove this return statement to use the following code ***
  6. return;
  7. string currentFolder = ImageGallery1.CurrentImagesFolder;
  8. // modify the directories allowed
  9. if (currentFolder == "~/images") {
  10. // these are the default directories FTB:ImageGallery will find
  11. string[] defaultDirectories = System.IO.Directory.GetDirectories(Server.MapPath(currentFolder),"*");
  12. // user defined custom directories
  13. string[] customDirectories = new string[] {"folder1","folder2"};
  14. // the gallery will use these images in this instance
  15. ImageGallery1.CurrentDirectories = customDirectories;
  16. }
  17. // modify the images allowed
  18. if (currentFolder == "~/images") {
  19. System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(Server.MapPath(currentFolder));
  20. // these are the default images FTB:ImageGallery will find
  21. System.IO.FileInfo[] defaultImages = directoryInfo.GetFiles("*");
  22. // user defined custom images (here, we're just allowing the first two)
  23. System.IO.FileInfo[] customImages = new System.IO.FileInfo[2] {defaultImages[0], defaultImages[1]};
  24. // the gallery will use these images in this instance
  25. ImageGallery1.CurrentImages = customImages;
  26. }
  27. }
  28. </script>
  29. <html>
  30. <head>
  31. <title>Image Gallery</title>
  32. </head>
  33. <body>
  34.     <form id="Form1" runat="server" enctype="multipart/form-data">  
  35.     
  36. <FTB:ImageGallery id="ImageGallery1" 
  37. JavaScriptLocation="ExternalFile" 
  38. UtilityImagesLocation="ExternalFile" 
  39. SupportFolder="~/aspnet_client/FreeTextBox/"
  40. AllowImageDelete=false AllowImageUpload=true AllowDirectoryCreate=false AllowDirectoryDelete=false runat="Server" />
  41. </form>
  42. </body>
  43. </html>