ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - File Upload - Inside obout Flyout

Click the button below to upload files.




ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.FileUpload" TagPrefix="obout" %>
<%@ Register Assembly="obout_Flyout2_NET" Namespace="OboutInc.Flyout2" TagPrefix="obout" %>
<script type="text/JavaScript">
function onClientBeforeUpload(sender, args) {
   $get("<%= label.ClientID %>;").innerHTML = ""
   return true;
}
function closeFlyout() {
   <%=Flyout1.getClientID() %>.Close();
   return false;
}
</script>
...
<asp:UpdatePanel runat="server" ID="UpdatePanel1"><ContentTemplate>
  <center>
      <asp:Button runat="server" ID="show" Text="Open 'Upload files' popup" OnClientClick="return false;" />
      <br /><br />
      <asp:Label runat="server" ID="label" Text="" />
  </center>
  <obout:Flyout runat="server" ID="Flyout1" AttachTo="show" OpenEvent="ONCLICK" CloseEvent="NONE" >
     <div style="border: solid 1px black; padding:3px; background-color: White;filter:alpha(opacity:100);">
        <obout:FileUpload OnClientBeforeUpload="onClientBeforeUpload" MaximumTotalFileSize="10240"
                     Width="250px" runat="server" id="fileUpload1" />
        <asp:Button runat="server" ID="submit" OnClick="submit_clicked" Text="Upload selected files" />
        <asp:Button runat="server" ID="cancel" Text="Close" OnClientClick="return closeFlyout();" />
     </div>
  </obout:Flyout>
</ContentTemplate></asp:UpdatePanel>
C#
protected void submit_clicked(object sender, EventArgs e)
{
  string result = "";
  foreach (PostedFileInfo info in fileUpload1.PostedFiles)
  {
     if (result.Length == 0)
     {
        result = "<b>Uploaded files:</b><br><br>" +
                   "<table align='center' border='0' cellspacing='2' cellpadding='2'>" +
                   "<tr><td style='font-weight: bold; text-align:left;'>File name</td>" +
                   "<td style='font-weight: bold; text-align:left;'>Length</td>" +
                   "<td style='font-weight: bold; text-align:left;'>Content type</td></tr>";
     }
     result += "<tr><td style='text-align:left;'>" + info.FileName + "</td><td style='text-align:left;'>" +
                  info.ContentLength + "</td><td style='text-align:left;'>" + info.ContentType + "</td></tr>";
  }
  if (result.Length == 0)
  {
     result = "No files uploaded";
  }
  else
  {
     result += "</table>";
  }
  label.Text = result;
}

"Just check it out, and see the demo.., The new grid is rock.. Like it very much... You guys always come with the new thing... Drag and drop column header.. is amazing..and the performance is still the best Thank you very much"

Husain Ahmad

Random testimonial   All testimonials