Re: RE: How to use -- Attachments1.Items.Add

  •  08-15-2009, 3:54 AM

    Re: RE: How to use -- Attachments1.Items.Add

    Hi,
     
    Please check this sample code :
     
    1. protected override void OnLoad(EventArgs e)   
    2. {   
    3.     base.OnLoad(e);   
    4.   
    5.     //need check is postback or not too!   
    6.     if (!Page.IsPostBack)   
    7.     {   
    8.         string str = Server.MapPath("uploaded/img1.jpg");   
    9.         using (System.IO.FileStream streamImg = new System.IO.FileStream(str, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))   
    10.         {   
    11.   
    12.             Response.Write(streamImg.ToString());   
    13.                
    14.             Attachments1.Items.Add(192, "img1Filename", streamImg);   
    15.         }   
    16.     }   
    17.     Attachments1.AttachmentAdded += new AttachmentItemEventHandler(Attachments1_AttachmentAdded);     
    18.     ButtonDeleteAll.Click += new EventHandler(ButtonDeleteAll_Click);     
    19.     ButtonTellme.Click += new EventHandler(ButtonTellme_Click);     
    20. }  
     
    Regards,
    Terry
View Complete Thread