Ejemplo n.º 1
0
        protected void LV1_OnItemDataBound(object sender, ListViewItemEventArgs e)
        {
            HttpChannel chnl = new HttpChannel();

            try
            {
                ChannelServices.RegisterChannel(chnl, false);
            }
            catch (RemotingException ex)
            {
                //all good, nobody cares, but we log it
            }

            mgr = (INewsManager)Activator.GetObject(typeof(INewsManager), "http://localhost:1234/NewsManager.soap");

            HiddenField hiddenID = (HiddenField)e.Item.FindControl("IDHid");

            System.Web.UI.WebControls.Image imageControl = (System.Web.UI.WebControls.Image)e.Item.FindControl("newsPhoto");

            string ID     = hiddenID.Value;
            int    newsID = Convert.ToInt32(ID);

            byte[] imageArr = mgr.getNewsImage(newsID);
            imageControl.ImageUrl = "data:image;base64," + Convert.ToBase64String(imageArr);
        }