div tag disappears

Last post 04-06-2010, 2:26 AM by Kenneth. 9 replies.
Sort Posts: Previous Next
  •  03-04-2010, 8:08 AM 59165

    div tag disappears

    <CuteWebUI:UploadAttachments InsertText="Upload " runat="server" ManualStartUpload="true"

    ID="Attachments1" MultipleFilesUpload="true" OnAttachmentRemoveClicked="Attachments1_AttachmentDelete">

    </CuteWebUI:UploadAttachments>

    above control is inside the div tag, when the uploadfinished, the div tag gets disappears. and also when we click remove or deleteall 
     
    div tag gets disappears.
     
    Here the entire html code:

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/EEPMMenu.Master" CodeBehind="IM-AttachDocuments.aspx.cs" Inherits="OncorProject.IM_AttachDocuments" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

    <script language="javascript" type="text/javascript" src="Script/Documents.js"></script>

    <script language="javascript" type="text/javascript">

    function CallAttach()

    {

    document.getElementById('DivAttach').style.top=250;

    document.getElementById('DivAttach').style.left=200;

    document.getElementById('DivAttach').style.display='block';

    }

    function CallAttach(obj, e)

    {

    document.getElementById('DivAttach').style.top=WindowEventY(obj, e)-obj.offsetTop+10;

    document.getElementById('DivAttach').style.left=WindowEventX(obj, e)-obj.offsetLeft+100;

    document.getElementById('DivAttach').style.display='block';

    }

    function CallUploadNewVersion(obj, e,val)

    {

     

    document.getElementById('DivAttach').style.top=WindowEventY(obj, e)-obj.offsetTop+10;

    document.getElementById('DivAttach').style.left=WindowEventX(obj, e)-obj.offsetLeft+10;

    document.getElementById('DivAttach').style.display='block';

    document.getElementById(GetClientId('hdnDocumentVersionId')).value = val;

    document.getElementById(GetClientId('hdnIsNewVersion')).value = val;

    }

    </script>

     

     

    <div id="DivAttach" class="DivAttach">

    <table width="345" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td class="FormName" id="lblFormName">File Upload</td>

    </tr>

    </table>

    <div style="padding: 10px 7px 10px 7px; z-index: 101;">

    <table width="330" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td width="80" class="FilterLabel"> Attach URL</td>

    <td width="1" class="FilterLabel"> :</td>

    <td class="FilterField" >

    <CuteWebUI:UploadAttachments InsertText="Upload" runat="server"

    ID="Attachments1" MultipleFilesUpload="true" OnAttachmentRemoveClicked="Attachments1_AttachmentDelete">

    </CuteWebUI:UploadAttachments>

    <asp:FileUpload ID="FileUpload1" CssClass="ListBox" runat="server" Width="250px" Visible="false"/>

    </td>

    </tr>

    <tr>

    <td class="FilterLabel" style="height: 24px">

    </td>

    <td class="FilterLabel" style="height: 24px">

    </td>

    <td class="FilterField" >

    <asp:Button ID="Button1" CssClass="Button" runat="server" Text="DeleteAll" OnClick="ButtonDeleteAll_Click" /></td>

    </tr>

    <tr>

    <td class="FilterLabel" style="height: 24px">Description</td>

    <td class="FilterLabel" style="height: 24px"> :</td>

    <td class="FilterField" style="height: 24px"><asp:TextBox ID="txtDescription" runat="server" CssClass="NormalTxtBox" Width="250px"></asp:TextBox> </td>

    </tr>

    <tr align="right">

    <td class="FilterLabel">

    <asp:RadioButton ID="rdInspector" Visible="false" GroupName="RoleName" runat="server" Checked= "True" Text="Inspector" />&nbsp;

    <asp:RadioButton ID="rdProjectManager" Visible="false" GroupName="RoleName" runat="server" Text="Program Manager" />

    </td>

    <td class="FilterLabel" align="right" colspan="2">&nbsp;

    <asp:Button ID="btnAttachOk" CssClass="Button" runat="server" Text="Ok" OnClick="btnAttachOk_Click" />

    <asp:Button ID="Button2" CssClass="Button" runat="server" Text="MULITPLE" OnClick="btnMultipleAttach_Click" />

    <input id="btnURLCancel" class="Button" type="button" value="Cancel" onclick="document.getElementById('DivAttach').style.display='none'" />

    </td>

    </tr>

    </table>

    </div>

    </div>

     

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td valign="top">

    <div class="DivInnerTable" id="divSiteInfo" runat="server">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">

    <tr>

    <td>

    <!--Filter & Grid Table -->

    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="">

    <tr>

    <td width="1" valign="bottom">

    <img src="Images/TopBottomCorner_01.gif"></td>

    <td class="TopImg" width="100%">

    <img src="Images/Spacer.gif" width="1"></td>

    <td width="1">

    <img src="Images/TopBottomCorner_03.gif"></td>

    </tr>

    <tr>

    <td class="LeftImg">&nbsp;</td>

    <td class="Center">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td align="center" class="MessageLabel">&nbsp;<asp:Label ID="lblMessage" runat="server"></asp:Label></td>

    </tr>

    <tr><td align="right" class="FilterField"><asp:LinkButton ID="lnkBack" Text="Back" runat="server" OnClick="lnkBack_Click" /></td></tr>

    <tr><td class="AllMessage" align="center">Attach/View Documents</td></tr>

    <tr><td><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td width="80" class="FromLabel">Project Name </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblProjectName" Text="" runat="server" /></td>

    <td width="80" class="FromLabel">Project Code </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblProjectCode" Text="" runat="server" /></td>

    </tr>

    <tr runat="server" id="trCustomerSite" style="display:none;">

    <td width="80" class="FromLabel">Customer Site </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblCustomerSiteName" Text="" runat="server" /></td>

    <td width="80" class="FromLabel">ESI ID </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblESIID" Text="" runat="server" /></td>

    </tr>

    <tr runat="server" id="trMeasure" style="display:none;">

    <td width="80" class="FromLabel">Measure Name </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblMeasureName" Text="" runat="server" /></td>

    <td colspan="3">&nbsp;</td>

    </tr>

     

    <tr><td colspan="6" class="AllMessage">&nbsp;</td></tr>

    <tr><td colspan="6"><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    <tr><td colspan="6" class="PostNewMsg" align="center"><asp:HyperLink ID="lnkFileUpload" Style="cursor: pointer" runat="server" Text="Upload a file" /></td></tr>

    <tr><td colspan="6"><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    </table>

    <div style="margin-top: -5px; z-index: 1001; overflow: auto;" runat="server" id="pnlInfoPathPage">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td><asp:PlaceHolder ID="phDocument" runat="server"></asp:PlaceHolder>

    <asp:HiddenField ID="hdnDocumentVersionId" runat="server" />

    <asp:HiddenField ID="hdnIsNewVersion" runat="server" />

    <asp:HiddenField ID="hdnDocLevel" runat="server" />

    <asp:HiddenField ID="PageNavigate" runat="server" />

    <asp:HiddenField ID="hdnProjectfile" runat="server" />

    </td>

    </tr>

    </table>

    </div>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td class="" width="">

    <img src="Images/Spacer.gif" width="1" height="10"></td>

    </tr>

    </table>

    </td>

    <td class="RightImg">&nbsp;</td>

    </tr>

    <tr>

    <td><img src="Images/TopBottomCorner_06.gif"></td>

    <td class="BottomImg"><img src="Images/Spacer.gif" width="1" height="6"></td>

    <td><img src="Images/TopBottomCorner_07.gif"></td>

    </tr>

    </table>

    </td>

    </tr>

    </table>

    </div>

    </td>

    </tr>

    </table>

    </asp:Content>

    Filed under:
  •  03-04-2010, 9:18 AM 59167 in reply to 59165

    Re: div tag disappears

    <%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/EEPMMenu.Master" CodeBehind="IM-AttachDocuments.aspx.cs" Inherits="OncorProject.IM_AttachDocuments" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">

    <script language="javascript" type="text/javascript" src="Script/Documents.js"></script>

    <script language="javascript" type="text/javascript">

    function CallAttach()

    {

    document.getElementById('DivAttach').style.top=250;

    document.getElementById('DivAttach').style.left=200;

    document.getElementById('DivAttach').style.display='block';

    }

    function CallAttach(obj, e)

    {

    document.getElementById('DivAttach').style.top=WindowEventY(obj, e)-obj.offsetTop+10;

    document.getElementById('DivAttach').style.left=WindowEventX(obj, e)-obj.offsetLeft+100;

    document.getElementById('DivAttach').style.display='block';

    }

    function CallUploadNewVersion(obj, e,val)

    {

     

    document.getElementById('DivAttach').style.top=WindowEventY(obj, e)-obj.offsetTop+10;

    document.getElementById('DivAttach').style.left=WindowEventX(obj, e)-obj.offsetLeft+10;

    document.getElementById('DivAttach').style.display='block';

    document.getElementById(GetClientId('hdnDocumentVersionId')).value = val;

    document.getElementById(GetClientId('hdnIsNewVersion')).value = val;

    }

    </script>

     

     

    <div id="DivAttach" class="DivAttach">

    <table width="345" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td class="FormName" id="lblFormName">File Upload</td>

    </tr>

    </table>

    <div style="padding: 10px 7px 10px 7px; z-index: 101;">

    <table width="330" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td width="80" class="FilterLabel"> Attach URL</td>

    <td width="1" class="FilterLabel"> :</td>

    <td class="FilterField" >

    <CuteWebUI:UploadAttachments InsertText="Upload" runat="server"

    ID="Attachments1" MultipleFilesUpload="true" OnAttachmentRemoveClicked="Attachments1_AttachmentDelete">

    </CuteWebUI:UploadAttachments>

    <asp:FileUpload ID="FileUpload1" CssClass="ListBox" runat="server" Width="250px" Visible="false"/>

    </td>

    </tr>

    <tr>

    <td class="FilterLabel" style="height: 24px">

    </td>

    <td class="FilterLabel" style="height: 24px">

    </td>

    <td class="FilterField" >

    <asp:Button ID="Button1" CssClass="Button" runat="server" Text="DeleteAll" OnClick="ButtonDeleteAll_Click" /></td>

    </tr>

    <tr>

    <td class="FilterLabel" style="height: 24px">Description</td>

    <td class="FilterLabel" style="height: 24px"> :</td>

    <td class="FilterField" style="height: 24px"><asp:TextBox ID="txtDescription" runat="server" CssClass="NormalTxtBox" Width="250px"></asp:TextBox> </td>

    </tr>

    <tr align="right">

    <td class="FilterLabel">

    <asp:RadioButton ID="rdInspector" Visible="false" GroupName="RoleName" runat="server" Checked= "True" Text="Inspector" />&nbsp;

    <asp:RadioButton ID="rdProjectManager" Visible="false" GroupName="RoleName" runat="server" Text="Program Manager" />

    </td>

    <td class="FilterLabel" align="right" colspan="2">&nbsp;

    <asp:Button ID="btnAttachOk" CssClass="Button" runat="server" Text="Ok" OnClick="btnAttachOk_Click" />

    <asp:Button ID="Button2" CssClass="Button" runat="server" Text="MULITPLE" OnClick="btnMultipleAttach_Click" />

    <input id="btnURLCancel" class="Button" type="button" value="Cancel" onclick="document.getElementById('DivAttach').style.display='none'" />

    </td>

    </tr>

    </table>

    </div>

    </div>

     

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td valign="top">

    <div class="DivInnerTable" id="divSiteInfo" runat="server">

    <table width="100%" border="0" cellpadding="0" cellspacing="0">

    <tr>

    <td>

    <!--Filter & Grid Table -->

    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="">

    <tr>

    <td width="1" valign="bottom">

    <img src="Images/TopBottomCorner_01.gif"></td>

    <td class="TopImg" width="100%">

    <img src="Images/Spacer.gif" width="1"></td>

    <td width="1">

    <img src="Images/TopBottomCorner_03.gif"></td>

    </tr>

    <tr>

    <td class="LeftImg">&nbsp;</td>

    <td class="Center">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td align="center" class="MessageLabel">&nbsp;<asp:Label ID="lblMessage" runat="server"></asp:Label></td>

    </tr>

    <tr><td align="right" class="FilterField"><asp:LinkButton ID="lnkBack" Text="Back" runat="server" OnClick="lnkBack_Click" /></td></tr>

    <tr><td class="AllMessage" align="center">Attach/View Documents</td></tr>

    <tr><td><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td width="80" class="FromLabel">Project Name </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblProjectName" Text="" runat="server" /></td>

    <td width="80" class="FromLabel">Project Code </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblProjectCode" Text="" runat="server" /></td>

    </tr>

    <tr runat="server" id="trCustomerSite" style="display:none;">

    <td width="80" class="FromLabel">Customer Site </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblCustomerSiteName" Text="" runat="server" /></td>

    <td width="80" class="FromLabel">ESI ID </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblESIID" Text="" runat="server" /></td>

    </tr>

    <tr runat="server" id="trMeasure" style="display:none;">

    <td width="80" class="FromLabel">Measure Name </td>

    <td width="1" class="FilterLabel" >:</td>

    <td width="140" class="FromField"><asp:Label ID="lblMeasureName" Text="" runat="server" /></td>

    <td colspan="3">&nbsp;</td>

    </tr>

     

    <tr><td colspan="6" class="AllMessage">&nbsp;</td></tr>

    <tr><td colspan="6"><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    <tr><td colspan="6" class="PostNewMsg" align="center"><asp:HyperLink ID="lnkFileUpload" Style="cursor: pointer" runat="server" Text="Upload a file" /></td></tr>

    <tr><td colspan="6"><img src="Images/Spacer.gif" width="1" height="10" /></td></tr>

    </table>

    <div style="margin-top: -5px; z-index: 1001; overflow: auto;" runat="server" id="pnlInfoPathPage">

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td><asp:PlaceHolder ID="phDocument" runat="server"></asp:PlaceHolder>

    <asp:HiddenField ID="hdnDocumentVersionId" runat="server" />

    <asp:HiddenField ID="hdnIsNewVersion" runat="server" />

    <asp:HiddenField ID="hdnDocLevel" runat="server" />

    <asp:HiddenField ID="PageNavigate" runat="server" />

    <asp:HiddenField ID="hdnProjectfile" runat="server" />

    </td>

    </tr>

    </table>

    </div>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">

    <tr>

    <td class="" width="">

    <img src="Images/Spacer.gif" width="1" height="10"></td>

    </tr>

    </table>

    </td>

    <td class="RightImg">&nbsp;</td>

    </tr>

    <tr>

    <td><img src="Images/TopBottomCorner_06.gif"></td>

    <td class="BottomImg"><img src="Images/Spacer.gif" width="1" height="6"></td>

    <td><img src="Images/TopBottomCorner_07.gif"></td>

    </tr>

    </table>

    </td>

    </tr>

    </table>

    </div>

    </td>

    </tr>

    </table>

    </asp:Content>

  •  03-05-2010, 8:13 AM 59194 in reply to 59167

    Re: div tag disappears

    Dear senthilkumart,
     
    Your code is not runnable  and some methods are missing, please describe your issue and give us more information about it or create a runnable snippet to demo this issue.
    Sorry for inconvenience.
     
    Regards,
    Eric
     
     
  •  03-07-2010, 7:51 PM 59221 in reply to 59167

    Re: div tag disappears

    Hi senthilkumart ,
     
    I tested the code you provide, itworks fine for me.
     
    Is your site online? If so, please send the test page url to me and set a border(border:solid 1px red) to the dive, I will test it and get back to you as soon as possible.
     
    Regards,
     
    Ken
  •  03-18-2010, 7:47 AM 59469 in reply to 59221

    Reg: Downlaoded


     1. using  CuteWebUI:UploadAttachments :- iam saving the filesize and filename and other details in db.
     
    for the downloading the files, the filesize and filename will be fetched from db and below code is used for downloading.
     
    When i  download file, it is not opening , telling that no preview is available.
     
    Below is the code:-
     

    Page.Response.Clear();

    Response.ClearContent();

    Response.ClearHeaders();

    switch (FileType.ToUpper())

    {

    case "XLS": Response.ContentType = "application/ms-excel"; break;

    case "XLSX": Response.ContentType = "application/ms-excel"; break;

    case "DOC": Response.ContentType = "application/msword"; break;

    case "DOCX": Response.ContentType = "application/msword"; break;

    case "PDF": Response.ContentType = "application/ms-excel"; break;

    case "HTML": Response.ContentType = "application/octet-stream"; break;

    case "XML": Response.ContentType = "application/octet-stream"; break;

    case "XSN": Response.ContentType = "application/msinfopath"; break;

    default: Response.ContentType = "application/octet-stream"; break;

    }

    Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName + "");

    Response.OutputStream.Write( DocumentFile, 0, DocumentFile.Length);

    Response.BinaryWrite(DocumentFile);

    Response.Flush();

    Response.Close();
     
    Problem is in DocumentFile  size .
     
    Same code is working fine for asp.net file upload control. I have already mentioned in chat about this issue..
     
     
     
    Can you provide me solution.
     
    Regards
    SenthilkumarT
  •  03-19-2010, 4:00 AM 59508 in reply to 59469

    Re: Reg: Downlaoded

    Hi senthilkumart,
     
     
    You can find the source code in download package.
     
    Regards,
     
    Ken

     
  •  03-22-2010, 3:33 AM 59546 in reply to 59508

    Re: Reg: Downlaoded


    In the following link  http://www.ajaxuploader.com/Demo/Ajax-based-File-storage.aspx., file is saved in some location and downloading the from the location ,based on the path and file name saved in DB.

    But for me just iam saving the file size and file name in db.  Project already in production. if change the code  based on the url what u send, then it will problem, b'cas we are not saving the file  locally or any where else. Just saving the file size which returns the bytest of array.
    so image will be saved in db as bytes of array.
     
    i. e Response.OutputStream.Write( DocumentFile, 0, DocumentFile.Length); in this line  DocumentFile is file size  of upload file which type is bytes of array, but the ajaxuploader returns the int. so at time of downloading the file, the file can not viewed.
     
     
    Use the below control, upload and save the filename and filesize in db , fetching the same details from the db for the downloading using the below code. try it.
     

    <asp:FileUpload ID="FileUpload1" CssClass="ListBox" runat="server" Width="250px"  />


     
     
     
     
     1. using  CuteWebUI:UploadAttachments :- iam saving the filesize and filename and other details in db.
     
    for the downloading the files, the filesize and filename will be fetched from db and below code is used for downloading.
     
    When i  download file, it is not opening , telling that no preview is available.
     
    Below is the code:-
     

    Page.Response.Clear();

    Response.ClearContent();

    Response.ClearHeaders();

    switch (FileType.ToUpper())

    {

    case "XLS": Response.ContentType = "application/ms-excel"; break;

    case "XLSX": Response.ContentType = "application/ms-excel"; break;

    case "DOC": Response.ContentType = "application/msword"; break;

    case "DOCX": Response.ContentType = "application/msword"; break;

    case "PDF": Response.ContentType = "application/ms-excel"; break;

    case "HTML": Response.ContentType = "application/octet-stream"; break;

    case "XML": Response.ContentType = "application/octet-stream"; break;

    case "XSN": Response.ContentType = "application/msinfopath"; break;

    default: Response.ContentType = "application/octet-stream"; break;

    }

    Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName + "");

    Response.OutputStream.Write( DocumentFile, 0, DocumentFile.Length);

    Response.BinaryWrite(DocumentFile);

    Response.Flush();

    Response.Close();
     
    Problem is in DocumentFile  size .
     
    Same code is working fine for asp.net file upload control. I have already mentioned in chat about this issue..
     
     
     
    Can you provide me solution.
  •  03-25-2010, 4:39 AM 59642 in reply to 59546

    Re: Reg: Downlaoded

    Hi senthilkumart,
     
    Please download the example below.
     
    In the example, I storage the image into database(only the name and the content.  the content store as image type in sql2005).
     
    Befare you test, you need to create a database name "Uploader". create a table in that db name "UploadFiles"
     
    table have two columns. column 1 name "ImageData", type is "image". column 2 name "FileName", type is "char(50)".
     
    Change the connectionString in page "Default.aspx"
     
    After done these, you can run the page directly.
     
    Any questions you can send a mail to me.
     
     
     
    Regards,
     
    ken
  •  03-30-2010, 7:09 AM 59735 in reply to 59642

    Re: Reg: Downlaoded


      Hi,
     
       Have you tried the above coding. for me still problem..
     
      At the same time , while attaching the items to mail, after receiving the mail. the attachment opened empty.
     
    the below code : for attachment for the mail:

    foreach (AttachmentItem item in ctrlUploadAttachments.Items)

    {

    byte[] data = new byte[item.FileSize];

    objUploadFileItemDTO.FileBytes = data;

    string[] ChkFileType;

    ChkFileType = item.FileName.Split('.');

    string FileType = ChkFileType.GetValue(1).ToString();

    switch (FileType.ToUpper())

    {

    case "XLS": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;

    case "XLSX": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;

    case "DOC": objUploadFileItemDTO.ContentType = "application/msword"; break;

    case "PDF": objUploadFileItemDTO.ContentType = "application/ms-excel"; break;

    case "HTML": objUploadFileItemDTO.ContentType = "application/octet-stream"; break;

    case "XML": objUploadFileItemDTO.ContentType = "application/octet-stream"; break;

    case "XSN": objUploadFileItemDTO.ContentType = "application/msinfopath"; break;

    default: objUploadFileItemDTO.ContentType = "application/octet-stream"; break;

    }

    objUploadFileItemDTO.FileName = item.FileName;

     
    }

    MemoryStream objMemoryStream = new MemoryStream((objUploadFileItemDTO.FileBytes);

    Attachment objAttachment = new Attachment(objMemoryStream, objUploadFileItemDTO.ContentType);

    objAttachment.ContentDisposition.DispositionType = System.Net.Mime.DispositionTypeNames.Attachment;

    objAttachment.ContentDisposition.FileName = objUploadFileItemDTO.FileName;

     

     

    objMailMessage.Attachments.Add(objAttachment);
    thanks
    Senthilkumar.T
     
     
  •  04-06-2010, 2:26 AM 59892 in reply to 59735

    Re: Reg: Downlaoded

    Hi senthilkumart ,
     
    Try this way, it works fine for me.
    1. MailMessage message = new MailMessage();   
    2.       foreach (AttachmentItem item in uploader1.Items)   
    3.       {    
    4.        Attachment attachemnt = new Attachment(item.OpenStream(),"p1.jpg","image/jpeg");   
    5.       message.Attachments.Add(attachemnt);   
    6.       }  
    Regards,
     
    Ken
View as RSS news feed in XML