This is a migrated thread and some comments may be shown as answers.

Upload/preview image with employee data

1 Answer 56 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Rick Mueller
Top achievements
Rank 1
Rick Mueller asked on 01 Dec 2010, 06:15 PM
Hello,
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

Thoughts?

Rick
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;
            }
            else
            {
                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.InsertEmployeeAsync(record);
            proxy.InsertEmployeeCompleted += (s, arg) =>
            {
  
                string ret = arg.Result;
                MessageBox.Show(ret);
            };
  
  
        }
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

1 Answer, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 02 Dec 2010, 09:18 AM
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.

Greetings,
Alex Fidanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
Upload
Asked by
Rick Mueller
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Share this question
or