Upload/preview image with employee data

2 posts, 0 answers
  1. Rick Mueller
    Rick Mueller avatar
    103 posts
    Member since:
    Feb 2010

    Posted 01 Dec 2010 Link to this post

    I able to upload and save data correctly to my database thru wcf, using the basic OpenFileDialog.
    At this point I'm not able to preview te picture after selection just during selection.

    I tried to use the upload control in my situtuion but no luck


    ublic void Preview_Record(object sender, RoutedEventArgs e)
                // select an image into byte[] bytes
                byte[] bytes = null;
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Multiselect = false;
                dlg.Filter = "JPEG files| *.jpg";
                bool? retval = dlg.ShowDialog();
                if (retval != null && retval == true)
                    Stream stream = (Stream)dlg.File.OpenRead();
                    bytes = new byte[stream.Length];
                    stream.Read(bytes, 0, (int)stream.Length);
                    StatusText.Text = dlg.File.Name;
                    StatusText.Text = "No Image selected...";
    ublic void Submit_Record(object sender, RoutedEventArgs e)

                // Save record to data base
                MySev.MyWebClient proxy = new MySev.MyWebClient();
                EMPLOYEE record = new EMPLOYEE();
                record.LAST_NAME = this.lastName.Text;
                record.FIRST_NAME = this.FirstName.Text;
                record.ADDRESS = this.Addy.Text;
                record.CITY = this.CityTxt.Text;
                record.STATE = this.State.Text;
                record.ZIP = this.Ziptxt.Text;
                record.PHONE1 = this.ph1.Text;
                record.RATING = 3;
                record.PICTURE = bytes;
                record.USER_ADDED = "Test"; // required for all insert wcf
                record.LAST_USER_UPDT = "Test"; // required for all insert wcf
                //string ret = proxy.InsertEmployeeCompleted(record); This statement is for WPF application
                // For Silverlight use these statements 
                proxy.InsertEmployeeCompleted += (s, arg) =>
                    string ret = arg.Result;
    I'm trying to upload the image with data and preview the image, When the user is satisified then click submit and it loads into the database

    Thank you
  2. Alex Fidanov
    Alex Fidanov avatar
    637 posts

    Posted 02 Dec 2010 Link to this post

    Hi Rick Mueller,

    Have you looked at this example for the RadUpload in our online samples? It seems to be pretty close to what you are trying to achieve.

    Alex Fidanov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top